[QLab] Shuffle Cues In A Group

7,523 views
Skip to first unread message

Rich Walsh

unread,
Jan 11, 2011, 8:04:26 AM1/11/11
to Discussion and support for QLab users.
Whilst the "Fire random child and go to next cue" mode of a Group Cue is very useful, it doesn't allow you to play _all_ the cues in a Group Cue in a random order - which may occasionally be useful to break up the monotony of hearing the preshow music in exactly the same order every night. Gareth Fry and I pondered this briefly on a show back in December, and on Saturday I finally found 10 minutes to knock up a little script to do this:

-- Shuffle the cues in a specific Group Cue and set them to play consecutively (you should turn this into a Script Cue)

tell application "QLab"
set userGroupCueNumber to "1" -- Change this to the q number of the Group Cue
set userOverlap to -1 -- Use this variable to define how long before the end of a cue the next one should start (eg: "-1" will give a 1s overlap)
tell front workspace
set theGroupCue to cue userGroupCueNumber
set countCues to count cues of theGroupCue
repeat countCues times -- This won't always move every cue, but should move sufficient to randomise the order
set eachCueID to uniqueID of some item of items 1 thru -1 of (cues of theGroupCue as list) -- Trying to move the last cue to the end will result in a non-functional copy of it
move cue id eachCueID of theGroupCue to end of theGroupCue
end repeat
set shuffledCues to cues of theGroupCue
repeat with i from 1 to countCues
set eachCue to item i of shuffledCues
if i is not countCues then
set post wait of eachCue to (duration of eachCue) + userOverlap
set continue mode of eachCue to auto_continue
else
set post wait of eachCue to 0
set continue mode of eachCue to do_not_continue
end if
end repeat
end tell
end tell

Rich

(Apologies if you end up getting this several times: I'd managed to create an email wormhole with a particular combination of characters in a plain text email and the email kept disappearing!)
________________________________________________________
WHEN REPLYING, PLEASE QUOTE ONLY WHAT YOU NEED. Thanks!
Change your preferences or unsubscribe here:
http://lists.figure53.com/listinfo.cgi/qlab-figure53.com
Follow Figure 53 on Twitter here: http://twitter.com/Figure53

Geoff Hollingshead

unread,
Jan 11, 2011, 10:18:54 AM1/11/11
to Discussion and support for QLab users.
That's great Rich

I've been thinking about this for a while not only to keep myself sane but also the patrons who come see the show two, three or more times!

Cheers

Geoff
------------------------------ IMPORTANT NOTICE ------------------------------
This email transmission and any accompanying attachments contain confidential
information intended only for the use of the individual or entity named above.
Any dissemination, distribution, copying or action taken in reliance on the
contents of this email by anyone other than the intended recipient is strictly
prohibited. If you have received this email in error please immediately delete
it and notify sender at the above email address.
------------------------------ IMPORTANT NOTICE ------------------------------

Daren Smith

unread,
Jul 20, 2013, 12:26:43 PM7/20/13
to ql...@googlegroups.com, Discussion and support for QLab users.
Worked like a charm. Thanks!


Timothy Neville

unread,
Sep 7, 2016, 8:59:37 PM9/7/16
to QLab, ql...@lists.figure53.com
Do you have a fix for this in QLab 3, I can't seem to get it to work?...

Kind Regards,
Tim

Rich Walsh

unread,
Sep 8, 2016, 4:23:16 AM9/8/16
to ql...@googlegroups.com
It works fine in QLab 3. What is the issue?

This public version does not in fact protect against the edge case mentioned in the comments: it should be “items 1 thru -2”. My version has that, but I don’t know if I republished this as any point in the last 5 years…

I have added a couple of lines to check that cue userGroupCueNumber is in fact a Group Cue, and sets it to the mode required: see attached.

Rich
Shuffle Cues.cues

Timothy Neville

unread,
Sep 12, 2016, 10:44:19 AM9/12/16
to QLab
Hi Rich,

Sorry - the issue was me! I'd copied in the line "tell application "QLab"" in error! The new script looks much better and is working a charm for me. Thanks a lot for this - really appreciate it. :-)

Kind Regards,
Tim

Heather Pynne

unread,
Mar 24, 2017, 1:05:11 PM3/24/17
to QLab, ql...@lists.figure53.com

Hi Rich - 


I had this in the new Qlab4 and it was working fine, then qlab closed without notice and when I re-opened my file the script no longer works.

Any thoughts?

Thanks!
Heather 

Rich Walsh

unread,
Mar 24, 2017, 1:11:05 PM3/24/17
to ql...@googlegroups.com
I might need a bit more info…

That’s quite an old script which I don’t immediately recall; I have a version on my laptop from 2011?! Can you send me the code and describe any error messages and what is/isn’t happening?

From a brief glimpse I think it may suffer from QLab 4’s new rules about continue mode in fire all groups…

Rich

Heather Pynne

unread,
Mar 25, 2017, 11:26:53 PM3/25/17
to QLab
Hi Rich - Nevermind! I got it working again.

Thanks,
Heather

Hayden Allred

unread,
May 11, 2017, 1:30:26 PM5/11/17
to QLab, ql...@lists.figure53.com
I slightly modified the code to work in QLab 4. Here is the script if anyone is having troubles.

tell application id "com.figure53.QLab.4"
set userGroupCueNumber to "1" -- Change this to the q number of the Group Cue
set userOverlap to -1 -- Use this variable to define how long before the end of a cue the next one should start (eg: "-1" will give a 1s overlap)
tell front workspace
set theGroupCue to cue userGroupCueNumber
set countCues to count cues of theGroupCue
repeat countCues times -- This won't always move every cue, but should move sufficient to randomise the order
set eachCueID to uniqueID of some item of items 1 thru -1 of (cues of theGroupCue as list) -- Trying to move the last cue to the end will result in a non-functional copy of it
move cue id eachCueID of theGroupCue to end of theGroupCue
end repeat
set shuffledCues to cues of theGroupCue
repeat with i from 1 to countCues
set eachCue to item i of shuffledCues
if i is not countCues then
set post wait of eachCue to (duration of eachCue) + userOverlap
set continue mode of eachCue to auto_continue
else
set post wait of eachCue to 0
set continue mode of eachCue to do_not_continue
end if
end repeat
end tell
end tell


Take care!
Hayden Allred

Rich Walsh

unread,
May 12, 2017, 6:58:42 AM5/12/17
to ql...@googlegroups.com
I think you changed one line?

For QLab 4 I’d use:

-- Shuffle the cues in a specific Group Cue and set them to play consecutively

set userGroupCueNumber to "1" -- Change this to the q number of the Group Cue
set userOverlap to -1 -- Use this variable to define how long before the end of a cue the next one should start (eg: "-1" will give a 1s overlap); NB: you can’t add gaps with +ve overlaps though

tell application id "com.figure53.QLab.4" to tell front workspace
set theGroupCue to cue userGroupCueNumber
set mode of theGroupCue to fire_first_go_to_next_cue -- Have to make sure of this in v4
set countCues to count cues of theGroupCue
repeat countCues times -- This won't always move every cue, but should move sufficient to randomise the order
set eachCueID to uniqueID of some item of items 1 thru -2 of (cues of theGroupCue as list) -- Trying to move the last cue to the end will result in a non-functional copy of it…
move cue id eachCueID of theGroupCue to end of theGroupCue
end repeat
set shuffledCues to cues of theGroupCue
repeat with i from 1 to countCues
set eachCue to item i of shuffledCues
if i is not countCues then
set post wait of eachCue to userOverlap -- v4 accepts -ve post waits!
set continue mode of eachCue to auto_continue
else
set post wait of eachCue to 0
set continue mode of eachCue to do_not_continue
end if
end repeat
end tell

Rich

--
Contact support anytime: sup...@figure53.com
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/f851eee7-9dd6-4f33-9cbc-0f5495ef8b53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

D.R. Amromin

unread,
Jun 20, 2017, 9:44:56 AM6/20/17
to QLab, ql...@lists.figure53.com
So cool! I'd never used a "Script Cue" - now I know what it is! Of course script code is essentially gibberish to me... BUT that's why this was so helpful. Thanks, Rich!

~D.R.

davide....@gmail.com

unread,
Apr 14, 2018, 6:10:59 PM4/14/18
to QLab
Thank you Rick this is exactly what I needed to shuffle preshow music. However, how do I make the so-created-playlist repeat itself forever, until I hit GO for the next cue, that would actually fade and stop it the preshow music?

Forgive me if it's something stupid, I started using QLab two days ago.

Grazie
Davide

Jeremy Davidson

unread,
Oct 3, 2018, 1:10:58 AM10/3/18
to QLab
Hey Rick,

I tried copying and pasting this into my cue list, changed and deleted the necessary things, and I'm still getting an error. The error says: ERROR: QLab got an error: Can't set mode of audio cue to any. (-10006)

Any thoughts?

Im using QLab 4.3.1. Thanks,

Jeremy Davidson

unread,
Oct 3, 2018, 1:16:32 AM10/3/18
to QLab
To make the playlist stop, I would make another cue group that has a fade cue with the target set to the music group. Set this continue to auto-follow. Then add a stop cue to targeting the music group. This will fade the music when you hit go, and then stop whatever song is playing after the fade is compete.

Unsure on how to make the playlist continue to loop. I, too, would like to know how to make that happen.

Rich Walsh

unread,
Oct 3, 2018, 4:28:45 AM10/3/18
to ql...@googlegroups.com
To make a "Start first child and go to next cue" group loop you just need to add a Start Cue as the last cue, targeting the Group Cue and following on from the penultimate cue. You'll need to do that _after_ you've shuffled the cues!

To fade and stop a group you can use a single Fade Cue targeting the Group Cue with "Stop target when done" checked. You don't need a separate Stop Cue.

Rich

Rich Walsh

unread,
Oct 3, 2018, 4:29:57 AM10/3/18
to ql...@googlegroups.com
Do you in fact have a Group Cue numbered "1" – or is the script targeting an Audio Cue? Since there's only one line that sets the mode of a cue I'd say theGroupCue is not a Group Cue.

Rich

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