Dirty Programming: Clear your Cache in Qlab

This post has been updated after a Twitter conversation with the good folks at Figure 53 got me thinking…I’ve made this much more useful as a result, so you don’t pull your whole show down to a stop.
TL;DR:
Clearing out a buildup of cues in Qlab via a script, which is a little more graceful than hitting the Panic button.

The Story:
When I started programming shows in Qlab, I really went whole hog. My first real show involved audio playback, video playback, MIDI over the network to two other machines that were also doing video playback, and MIDI commands to a light board. I was also running timers and such.

It was the Wizard of Oz – not only was it a complex show for tech, but Qlab was the only thing out there that could help me make it all happen.

So, I was still learning and, looking back, made what were sloppy programming errors that led to the need for this script. You see, I had videos stacking up (probably forgot the “Stop on Fade Out” check box a number of times) and it was stealing system resources. So I needed a “Clear Cache” command that would run at certain times to just get rid of the junk still running, and not require me to remember hitting the Escape key.

This is an example of sloppy programming on my part, but I put it here in case it may be useful for someone.

The Esoteric Bit:
Once again we create a Script cue. I call mine “CLEAR CACHE” – in all caps because when it hits, it’s gonna wipe the board and I want to be sure I want it there. It’s like capitalizing the word blackout – not something to take lightly!

Here is the script:

tell application “QLab 3”
set cueList to current cue list of workspace 1
set mySel to cues of cueList
repeat with myCue in mySel
if running of myCue and q type of myCue is not “Script” and q number of myCue is not “4” then
stop myCue
end if
end repeat
end tell

Now, pay close attention to where it says “and q number of myCue is not “4”. Replace this number with a cue that you want to keep running. In my original show, I had a lot of video cues stacking up behind my current cue – I couldn’t see them, but they were all running. So by specifying a cue number to leave running, I could stop all of that in the background, and no one would notice (everything was a full-screen image in that show).

If you want to just stop everything, then take out that part entirely.

Now, insert this in your cue list wherever you end up with a build up of gunky cues. Of course, the proper thing to do would be to hunt down what is happening and actually fix the problem. But everyone is different, and in the run up to tech for the show, you might have some dangling ends that you want to deal with later.

I’m not saying you’re sloppy if you use this script. I’m just saying don’t be sloppy and use this script.

Cheers!
-brian

PS – In my conversation with Figure 53 that led to this update, their original suggestion was to just create a Stop Cue that targets the Cue List in question. No scripts needed. Well, that’s pretty easy and much neater! I originally wrote this script years ago, on my first Qlab show. I didn’t really know what I was doing, and clearly over-engineered a solution. However, this got me thinking about my original problem, which is why this script now allows you to leave some cues running while stopping all the rest. Teamwork!