script to duplicate record cue sequence with a hotkey

133 views
Skip to first unread message

Adam Pope

unread,
Apr 8, 2019, 2:39:08 AM4/8/19
to QLab
I am working on a cue to duplicate the record cue sequence with a hotkey. The way I have is set up is that I will have 2 or more cues grouped. I will start the first one and then hit the hotkey with each other cue selected to set the pre wait of that cue to the action elapsed of the current cue. I am super new to applescript and trying to piece it together (mostly as a way to teach myself about the scripting)

Here is what I have:

tell application id "com.figure53.QLab.4" to tell front workspace
try
repeat with targetcue in (parent of selected)
if targetcue is running then set targetcuetime to action elapsed of targetcue
end repeat
end try
set pre wait of selected to targetcuetime
end tell

I get "the variable targetcuetime is not defined. (-2753)

I have also tried it with "in front workspace" instead of "in parent of selected" with the same result

Adam Pope

unread,
Apr 8, 2019, 2:40:21 AM4/8/19
to QLab
by duplicate I just mean to have the same behaviour as the record cue sequence tool.

micpool

unread,
Apr 8, 2019, 6:48:23 AM4/8/19
to QLab
First of all, don't use try blocks until you know the script is functioning, as if the code fails within the try block you won't get any meaningful errors. In your case you got an error on the first code outside the try block because the code in the try block failed before assigning a value to targetcuetime.  Try cues are useful to quickly make working scripts fail silently, for instance if a script with a level was applied to a memo cue, without writing elaborate error routines, but they won't fix scripts that intrinsically don't work.

Always develop scripts in script editor, as you will get far more useful error messages to sort out what is going wrong. Then copy them into  cue within QLab and assign a hotkey.

I'm not sure quite what you want to achieve with this, but I am assuming:

you have an audio cue as the first cue in a  group which you will start playing by selecting it and pressing V.  The elapsed time of this cue is what you want to base the pre waits of subsequent cues on

you then want to select another cue in the group, press a hotkey to trigger the script, and have the elapsed time of the reference cue become the pre-wait for the selected cue. You then might want to select other cues in the group and press the hotkey again to get the next pre-wait time

So there is no repeat required in the script. You want to execute the script by means of the hotkey to apply it to as many cues as you want, but each time it is executed it is doing a single thing, i.e getting the elapsed time of the reference cue and setting the pre-wait of the selected cue to that value.

So you need to know what the reference cue is, and what the selected cue is, and you need to check that the reference cue is running.
So the script will be

tell application id "com.figure53.QLab.4" to tell front workspace

set thetargetcue to last item of (selected as list)

set thereferencecue to (first cue of (parent of thetargetcue))

if the running of thereferencecue is true then

set targetcuetime to action elapsed of thereferencecue

set pre wait of thetargetcue to targetcuetime

else

return

end if

end tell


Example workspace attached

Mic
Prewait setter.zip

Adam Pope

unread,
Apr 8, 2019, 12:56:52 PM4/8/19
to ql...@googlegroups.com
Thanks Mic,

What exactly does the else return bit do?

Cheers

--
Contact support anytime: sup...@figure53.com
Follow Figure 53 on Twitter: https://twitter.com/Figure53
User Group Code of Conduct: https://figure53.com/help/code-of-conduct/
---
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/ac95b685-b633-4e2c-84b6-8bf35c576ca2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

micpool

unread,
Apr 8, 2019, 12:59:48 PM4/8/19
to QLab
On Monday, April 8, 2019 at 5:56:52 PM UTC+1, Adam Pope wrote:
Thanks Mic,

What exactly does the else return bit do?

Nothing much at the moment. It's where you would put what you wanted to happen if the cue wasn't running e.g you could display a warning dialog, or even start the cue.

Mic

Adam Pope

unread,
Apr 8, 2019, 1:53:20 PM4/8/19
to ql...@googlegroups.com
oh start the cue I like that

--
Contact support anytime: sup...@figure53.com
Follow Figure 53 on Twitter: https://twitter.com/Figure53
User Group Code of Conduct: https://figure53.com/help/code-of-conduct/
---
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.
Reply all
Reply to author
Forward
0 new messages