Script, jump to last 10 seconds

839 views
Skip to first unread message

Tim Kruithof

unread,
Mar 1, 2021, 9:58:46 AM3/1/21
to QLab

Hi Guys,

I'm not very good with scripts in QLab.

Does somebody have a script to jump a cue to the last 10 seconds, to use during rehearsals etc.

Thanks,

Tim

Sam Kusnetz

unread,
Mar 1, 2021, 10:00:00 AM3/1/21
to QLab
Hi Tim

You can use the built-in load-to-time tool for this. Select a cue or cue sequence, open the tool using command-T, enter “-10” and hit enter. The cue or sequence will load to ten seconds before the end.

Best
Sam

––
Sam Kusnetz [he/him/his] (what is this?)
Figure 53
https://qlab.app | https://figure53.com
--
Contact support anytime: sup...@figure53.com
Follow QLab on Twitter: https://twitter.com/QLabApp
User Group Code of Conduct: https://qlab.app/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/0ba85fec-871f-423b-ae7e-e8ec02eac807n%40googlegroups.com.

Tim Kruithof

unread,
Mar 1, 2021, 10:13:20 AM3/1/21
to QLab
Do you know if there's a way to do this with one knob?

Op maandag 1 maart 2021 om 16:00:00 UTC+1 schreef sam kusnetz:

Sam Kusnetz

unread,
Mar 1, 2021, 11:00:17 AM3/1/21
to QLab
On Mar 1, 2021, 10:13 AM -0500, ql...@googlegroups.com, wrote:

Do you know if there's a way to do this with one knob?

I’m afraid I don’t know what you mean by “one knob”… can you give me a little more information about what you’re trying to do?

Sam

micpool

unread,
Mar 1, 2021, 11:29:11 AM3/1/21
to QLab
-- to skip to the last 10 seconds of a selected cue or timeline group
tell application id "com.figure53.QLab.4" to tell front workspace
try
set theselected to last item of (selected as list)
stop theselected
delay 0.1
load theselected time ((pre wait of theselected) + (duration of theselected)) - 10
delay 0.1
start theselected
end try
end tell

Rich Walsh

unread,
Mar 1, 2021, 12:18:12 PM3/1/21
to ql...@googlegroups.com
The AppleScript approach below resets levels to those stored in the cue(s), not those set by subsequent fades. I use this version.

However, I wonder if Tim meant what Sam was getting at: play the last 10s of a cue. I remember Denon (?) CD players having a button for that? Can't remember what it was called though… "Cue" maybe?

A quick hack of my "Crash Fades" macro gives me:

set userDuration to 10 -- This is the time remaining to which to load the selected cue(s) before starting them

tell front workspace
repeat with eachCue in (selected as list)
stop eachCue
set eachDuration to ((pre wait of eachCue) + (duration of eachCue)) -- Include the Pre Wait for effective duration
if eachDuration > userDuration then
load eachCue time eachDuration - userDuration
end if
start eachCue
end repeat
end tell

It probably needs a try block to be completely bulletproof in the wild.

Rich

Rich Walsh

unread,
Mar 1, 2021, 12:22:32 PM3/1/21
to ql...@googlegroups.com
I realise I didn't actually read Mic's script properly at all and just assumed it was nudging… Oops. That's the problem with planning an answer 3 steps back in a thread and not catching up before posting. Some of what I said is useful, but not all of it…

Rich

micpool

unread,
Mar 1, 2021, 12:46:30 PM3/1/21
to QLab
I assumed that Tim was just wanting a way to play the last few seconds of a cue, Denon style, with a single keypress (knob?), as opposed to the dozen key presses or so required, (including modifiers) to do it without a script.  Obviously, thats a worst case scenario assuming you are in show mode with the cue already running and want to be back in show mode after the operation.
Mic

Rich Walsh

unread,
Mar 2, 2021, 6:49:48 AM3/2/21
to ql...@googlegroups.com
Basically I didn't read anything you'd written and answered a completely different question. Sorry.

Anyway, I thought I would refresh my nudge macro to make it wrap around, and also look at how it handled rate ≠ 1 which has been bugging me for a while. This version will now standby for the last 10s of a cue if it's not loaded past the start, and then nudge back from there if you want. I think it works properly with different rates now – but the inconsistency in how the various tools interact with rate and pre wait makes this very confusing and I wouldn't be surprised if I've missed something! It's probably worth having the "crash to last 10s" as a separate macro too.

-- Only works properly when run as a separate process!
-- This process will not nudge into pre / post waits: it only works on the "action" of a cue
-- NB: the OSC command will NOT WORK if the workspace has a Passcode
-- (Have to use OSC as AppleScript "load" inadvertently resets Audio Cues to their programmed levels – ie: ignores subsequent fades)

set userNudge to -10
set userWrapAround to true -- Set this to false if you don't want to start nudging from the beginning when you hit the end (or vice versa)

tell application id "com.figure53.QLab.4" to tell front workspace
repeat with eachCue in (selected as list)
if q type of eachCue is not "Script" then -- Protect the script from running on itself
try


-- Pause the cue, if necessary


if running of eachCue is true then
pause eachCue
set startFlag to true
else
set startFlag to false
end if


-- Find out when we are


set eachDuration to duration of eachCue -- Need this again later, so store it


set elapsedTime to (percent action elapsed of eachCue) * eachDuration
-- ###FIXME### As of 4.6.9, "action elapsed" reports differently between clicking in waveform and loading to time when rate ≠ 1
-- Also, time reported by "action elapsed" _includes_ the pre wait whilst loadActionAt method will effectively add it back on again
-- (AppleScript "load" doesn't add pre wait back; nor does "Load to time…" function in Edit mode)


-- loadActionAt method "number" (time) ignores rate, so all times have to be scaled accordingly


set eachRate to rate of eachCue


set variNudge to userNudge * eachRate
set variDuration to eachDuration * eachRate
set variElapsed to elapsedTime * eachRate


-- Calculate time to load to, including wrapping round if needed


set loadTime to variElapsed + variNudge


if loadTime < 0 then -- We've reached the beginning
if userWrapAround is true and loadTimevariNudge then -- Go to 0 before wrapping (if cue is running it will never wrap…)
set loadTime to variDuration + variNudge
else
set loadTime to 0
end if
end if


if loadTime > variDuration then -- We've reached the end
if userWrapAround is true and loadTime - variDurationvariNudge then -- Go to end before wrapping
set loadTime to 0
else
set loadTime to variDuration
end if
end if


-- Load the cue: loadTime is the time into the _action_ of the cue as, according to the OSC API:
-- "QLab will automatically add the pre-wait [sic] of the specified cue … in order to load the cue to the correct time"


set eachID to uniqueID of eachCue


tell me to do shell script "echo '/cue_id/" & eachID & "/loadActionAt " & loadTime & "' | nc -u -w 0 localhost 53535"


-- Restart the cue if it was running


if startFlag is true then
start eachCue
end if


end try
end if
end repeat
end tell

Rich

Christian Lewis

unread,
Jun 22, 2021, 5:08:27 AM6/22/21
to QLab
Hi all, I'm like Tim, I don't really understand scripting (I would love it if there were some online training for creating scripts though!)

I have a similar requirement, I use groups for VT playback, in the group I have OSC commands to trigger other devices like VMIX to automate switching external outputs and mixing when triggering a VT and also at the end of the VT it sends OSC commands to mix and switch outputs again.

When in rehearsals after I have triggered the VT the show director often asks to jump to the last 10 - 15 seconds. I know i have to use the Active cue transport to do this as otherwise the auto follow actions don't work if I jump within the Video cue.

So, is there a simple script to tell Active Cue in the active cue list to jump to the last 10 seconds? so I can trigger this via companion?

Appreciate your support!

Cheers, Christian

micpool

unread,
Jun 22, 2021, 7:14:23 AM6/22/21
to QLab
This should do the bare bones of what you require

-- to skip to the last 10 seconds of the most recently started group cue

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

try

set theselected to last item of ((cues whose running is true and q type is "Group") as list)

stop theselected

delay 0.1

load theselected time ((pre wait of theselected) + (duration of theselected)) - 10

delay 0.1

start theselected

end try

end tell


You will have to check that the way QLab handles OSC cues in a timeline group when it is loaded to time is appropriate for your needs, but using this script is not dissimilar in this respect to scrubbing the group cue in active cues.

Mic


Christian Lewis

unread,
Jun 22, 2021, 8:05:19 AM6/22/21
to QLab
Hi Mic, thanks for the quick reply!

I have tried this script but it doesn't appear to do as expected. It just restarts the video clip from the beginning again?? Any thoughts?

Cheers

micpool

unread,
Jun 22, 2021, 8:19:19 AM6/22/21
to QLab
No idea.

Here's a screen recording of it working for me.

Post your workspace (without content) and I'll have a look

skip to end group.mov

Christian Lewis

unread,
Jun 22, 2021, 8:36:56 AM6/22/21
to QLab
Ah thanks for this, I see you have your group setup as timeline, I was using the standard group to fire 1st and enter group so I just use the video timing to Auto Follow at the end of the video rather than putting all post wait times etc. Your script works as you have shown with the timeline group, could it work with the Fire first and enter group Group if that makes sense??

Thanks

micpool

unread,
Jun 22, 2021, 8:48:35 AM6/22/21
to QLab
-- to skip to the last 10 seconds of a child video in  the most recently started group cue  by loading the group to a time based on the video duration
tell application id "com.figure53.QLab.4" to tell front workspace
try
set theselected to last item of ((cues whose running is true and q type is "Group") as list) --use first item if you have other nested group cues 
set thevideo to first cue of theselected whose q type is "video"
stop theselected
delay 0.1
load theselected time ((pre wait of thevideo) + (duration of thevideo)) - 10
delay 0.1
start theselected
end try
end tell

Christian Lewis

unread,
Jun 22, 2021, 8:54:53 AM6/22/21
to QLab
Perfect, thank you very much!! I really need to learn more about scripting! can you point me anywhere online to help learn?

Cheers
Christian

Reply all
Reply to author
Forward
0 new messages