script to test for active ques

173 views
Skip to first unread message

Jake Rich

unread,
Mar 3, 2016, 1:22:07 PM3/3/16
to QLab
Has anyone looked into the ability to ask qlab if it has any active ques playing? i'm creating a controller with xkeys and would like to have a light that is on when ques are active. maybe an applescript? does qlab report this over midi somehow?

Andy Lang

unread,
Mar 3, 2016, 1:36:16 PM3/3/16
to ql...@googlegroups.com

On Thu, Mar 3, 2016 at 7:22 PM Jake Rich lea...@gmail.com wrote:

Has anyone looked into the ability to ask qlab if it has any active ques playing? i'm creating a controller with xkeys and would like to have a light that is on when ques are active. maybe an applescript? does qlab report this over midi somehow?

You can determine this via AppleScript, but you’ll want to pick a sensible delay between loop iterations to keep from wasting tons of CPU time querying and calculating.

I don’t have a script offhand that does exactly what you want, but you can use this script I wrote for another customer to only “go” when no other cues were active as a starting point:

tell application id "com.figure53.qlab.3" to tell front workspace
        set cuesCount to -1 --set to -1 so it doesn't count itself!
        set activeCues to active cues
        repeat with eachCue in activeCues
                set cuesCount to cuesCount + 1
        end repeat
        if cuesCount is 0 then
                go
        end if
end tell

-Andy


Andy Lang
@SoundGuyAndysup...@figure53.com

Rich Walsh

unread,
Mar 3, 2016, 1:45:54 PM3/3/16
to ql...@googlegroups.com
In AppleScript you have:

active cues (list of cue, r/o) : The list of active cues (running or paused) in this workspace.

In OSC you have:

/workspace/{id}/runningCues

So you can do tell front workspace to (count active cues) = 0 to get something that is true or false, or you can parse some json to go via OSC.

What MIDI mechanism were you envisaging? I've not encountered a device that would report anything like this via MIDI…

Rich

Jake Rich

unread,
Mar 3, 2016, 2:45:07 PM3/3/16
to QLab
andy's script i think will get me there. i'm using an x-keys 80. but on the question of midi i was just curious if there was some kind of feedback to light up a control while playing, which is what i'll be making on my controller

Jake Rich

unread,
Mar 3, 2016, 4:11:49 PM3/3/16
to QLab
ok so since i'm doing this in controller mate, i'm a bit new to applescript interacting with other programs. if i want this running in the background how would i test it. I assume the "tell front workspace" is what is giving me my error on initialization

On Thursday, March 3, 2016 at 11:36:16 AM UTC-7, Andy Lang wrote:

Jake Rich

unread,
Mar 3, 2016, 6:22:27 PM3/3/16
to QLab
nvm i got it

tell application id "com.figure53.qlab.3" to tell front workspace
       
set cuesCount to 0

       
set activeCues to active cues
        repeat
with eachCue in activeCues
               
set cuesCount to cuesCount + 1
       
end repeat
       
if cuesCount is 0 then

               
return 1
   
else if cuesCount > 0 then
       
return 0
       
end if
end tell

Rich Walsh

unread,
Mar 3, 2016, 6:52:49 PM3/3/16
to ql...@googlegroups.com
That's an inefficient way to count something – you could replace the first half of your script with:

set cuesCount to count active cues

Indeed, you could replace your entire script with:

tell application id "com.figure53.qlab.3" to tell front workspace to return ((count active cues) = 0) as integer

However, it doesn't exclude itself from the count (as Andy's version did); in fact, in 3.1.22 you also need to not count the cue list that the Script Cue is running in (if you run a script inside the workspace you are querying then the count of active cues will always be at least 2).

I've knocked up the rather hideous workspace attached that will detect active cues with a 0.5s latency and only marginal CPU hit. You could simplify it by taking the OSC out – it's just for show.

I don't think this will be very satisfactory in the long run. Why do you need it?

Rich
Active cues detection.cues
Reply all
Reply to author
Forward
0 new messages