Script to change file target of audio cue

614 views
Skip to first unread message

Nick Kourtides

unread,
Aug 22, 2013, 6:53:45 PM8/22/13
to ql...@googlegroups.com
Hey all,

I've searched the archives and the wiki, and am having trouble with the syntax for a script cue. I need to make a live recording during a performance and use that media in a subsequent cue. I've written scripts that open quicktime, start and stop recording, and then export with a specific file name. I'd like to be able to update the target file for a specific audio cue via script to point to that media. I'm striking out with my attempts at set target file and even executing keystrokes (arrow down selected cue, t, etc..) Any thoughts?

Nick

Rich Walsh

unread,
Aug 22, 2013, 7:03:14 PM8/22/13
to ql...@googlegroups.com

It comes down to something like "set file target of theCue to theFile", although sometimes you have to try "file theFile" or "theFile as POSIX file" or variations thereon, depending on what class the variable theFile is in at this point.

Difficult to be specific without any specifics…

Rich

--
--
Change your preferences or unsubscribe here:
http://groups.google.com/group/qlab
 
Follow Figure 53 on Twitter: http://twitter.com/Figure53
 
---
You received this message because you are subscribed to the Google Groups "QLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qlab+uns...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Dave "luckydave" Memory

unread,
Aug 22, 2013, 7:06:58 PM8/22/13
to ql...@googlegroups.com
Hi Nick!

(Rich gave some good answers while I was composing this, but I'll post it anyway, because there some other tips in here.)


This script works on the selected cue, but you can modify it to use a cue number or some other way of finding the cue whose target should change. Note that the syntax is "set file target of {cue} to {file}", so "file target", not "target file". This script also prompts you to select the file, rather than specifying the file by its direct path. You can change that a bit to use the POSIX path instead of choosing the file in a dialog window.

A great thing about this script is that it keeps the cue's start and end times, as well as loop times.

If you still don't get it working with these tips, post the script so we can see what you've tried.

Nick Kourtides

unread,
Aug 22, 2013, 7:16:08 PM8/22/13
to ql...@googlegroups.com
Thanks Rich and luckydave,

I'm getting tripped up deleting the prompts and 'last cue in the list' elements of those example scripts. I want to keep this as lean as possible and point a specific cue number's target to a specific path to the media. I'm just not comfortable enough with the hooks to get it to compile correctly.

Nick

Rich Walsh

unread,
Aug 22, 2013, 7:19:38 PM8/22/13
to ql...@googlegroups.com
So (for cue numbered "1"):

set file target of cue "1" to POSIX file "/path/to/file"

Rich

Dave "luckydave" Memory

unread,
Aug 22, 2013, 7:32:21 PM8/22/13
to ql...@googlegroups.com
Here's a version that pares down what was on the wiki, and gives you a boilerplate to use in multiple cues, if needed:

tell front workspace
set theCue to cue "1"
set newFileTarget to POSIX file "/path/to/file"
if q type of theCue is "Audio" then
set currentStart to start time of theCue
set currentEnd to end time of theCue
set file target of theCue to newFileTarget
set start time of theCue to currentStart
set end time of theCue to currentEnd
end if
end tell

Nick Kourtides

unread,
Aug 22, 2013, 7:36:19 PM8/22/13
to ql...@googlegroups.com
Thanks Rich,

This:

tell application "QLab 2"
    set file target of cue "62" to POSIX file "Macintosh HD/Users/nick/dropbox/objectlesson/ZPhoneRecording.mov"
end tell

returns this error:

ERROR: Qlab 2 got an error: can't set cue "62" to file ":Macintosh HD:Users:nick:dropbox:objectlesson:ZPhoneRecording.mov"

any thoughts?

Rich Walsh

unread,
Aug 22, 2013, 7:38:01 PM8/22/13
to ql...@googlegroups.com
"Macintosh HD/Users/nick/dropbox/objectlesson/ZPhoneRecording.mov" isn't the POSIX path of the file. "/Macintosh HD/Users/nick/dropbox/objectlesson/ZPhoneRecording.mov" is.

Rich

Dave "luckydave" Memory

unread,
Aug 22, 2013, 7:39:47 PM8/22/13
to ql...@googlegroups.com
ERROR: Qlab 2 got an error: can't set cue "62" to file ":Macintosh HD:Users:nick:dropbox:objectlesson:ZPhoneRecording.mov"

Additionally, you need to "tell front workspace", because there's no cue "62" of the QLab application, only of the workspace. So you got two errors - no leading slash, and no workspace to find the cue in.

Rich Walsh

unread,
Aug 22, 2013, 7:41:30 PM8/22/13
to ql...@googlegroups.com
Sorry, correction: "/Users/nick/dropbox/objectlesson/ZPhoneRecording.mov". The easiest way to check the POSIX path of a file is to drag the file into an AppleScript Editor window. It even works in the Inspector for a Script Cue.

Rich

Nick Kourtides

unread,
Aug 22, 2013, 7:42:31 PM8/22/13
to ql...@googlegroups.com
Ack! of course. However, this compiles and runs, but doesn't change the target:

tell front workspace
    set file target of cue "62" to POSIX file "/Macintosh HD/Users/nick/dropbox/objectlesson/ZPhoneRecording.mov"
end tell

Nick Kourtides

unread,
Aug 22, 2013, 7:43:35 PM8/22/13
to ql...@googlegroups.com
Thanks both!!!

This works:

tell front workspace
    set file target of cue "62" to POSIX file "/Users/nick/dropbox/objectlesson/ZPhoneRecording.mov"
end tell

Nick

Joshua Langman

unread,
Aug 22, 2013, 11:07:33 PM8/22/13
to ql...@googlegroups.com
What if a Target cue could also be applied to audio and video cues, and would then let you specify a new file target?
Reply all
Reply to author
Forward
0 new messages