Show Control Cues Generator

[Updated for QLab 4.1 13 JUL 17]

Important Note: In QLab 4 the OSC Cue was renamed the Network Cue. In the scripts below any reference to q type “OSC” should be changed to q type “Network” if using them in QLab 4.

This workspace is really useful if you are using QLab to control a lighting console, a mixer, a different video server, QLab on another computer, or any other device which can be controlled by MIDI or OSC, and you want to a bunch of  cues  with sequential numbers. For instance if you need a 1000 lighting cues for QLab to send to an console then this workspace can produce them very quickly and save you hours of typing. It is probably best to generate the cues in this workspace and then cut and paste them into your active show.

There are 4 generators and they all work with template cues to configure the appropriate non changing parameters of the sequence e.g Destination Patch,  Device ID  Command etc. They  allow you to set the number of cues generated and an incremental value (not for MIDI PC). They also allow you to select whether  integer values in the sequence are integers or floats i.e whether cue 1 is 1 or 1.0 They name the generated cues as fully as possible.
The OSC custom message generator substitutes the character sequence $$$ in the custom message for the current index value of the sequence (It asks for the starting number)
The QLab format OSC generator uses the Q number in the template cue as its starting value as does the MSC  Generator
The MIDI PC uses the program number in the template cue as the first of the sequence and also asks you whether MIDI PC 0 or MIDI PC 1 = Preset 1 i.e (0-127 or 1-128)
Here it is in action:

How it Works: OSC (Open Sound Control)To minimise the number of dialogs that the user has to fill in, as much as possible is set in a template cue:

OSC Template

For the OSC cue the type will be set to custom message, the Destination patch set and the custom message is typed substituting the character sequence $$$ for the variable that will be incremented in each generated cue.

Here we have used an OSC command for a Resolume Arena video server: /track1/connect which we have typed as /track$$$/connect, and will generate the sequence; /track1/connect,/ track2/connect, /track3/connect etc.

Here’s the script for the script cue in the group:

display dialog “Number of cues to generate:” default answer “100”
if button returned of result = “cancel” then
return
else
set therepeat to (text returned of result) as integer
end if
display dialog “Starting value for variable?” default answer “1”
if button returned of result = “cancel” then
return
else
set theindex to (text returned of result) as real
end if
display dialog “Increment?” default answer “1”
if button returned of result = “cancel” then
return
else
set theincrement to (text returned of result) as real
end if
display dialog “Integer value format” buttons {“1”, “1.0”} default button “1”
set integertype to button returned of result
display dialog “Device Name for Q Name Text:” default answer “”
if button returned of result = “cancel” then
return
else
set thedevicename to (text returned of result) as string
end if
tell application id “com.figure53.qlab.3” to tell front workspace
try
if the osc message type of cue “OSCT” is not custom then
display dialog “This generator only makes lists from Custom OSC Messages”
return
end if
set the thedestinationpatch to patch of cue “OSCT”
repeat therepeat times
make type “OSC”
set theselectedcue to last item of (selected as list)
set the q_num of theselectedcue to theindex as string
set the q number of theselectedcue to “”
set the patch of theselectedcue to thedestinationpatch
set the osc message type of theselectedcue to custom
set thecustommessage to the custom message of cue “OSCT”
set AppleScript‘s text item delimiters to “$$$”
set the item_list to every text item of thecustommessage
if theindex mod 1 is 0 and integertype is “1” then
set AppleScript‘s text item delimiters to (theindex as integer) as string
else
set AppleScript‘s text item delimiters to theindex as string
end if
set thecustommessage to the item_list as string
set AppleScript‘s text item delimiters to “”
set the custom message of theselectedcue to thecustommessage
set the q name of theselectedcue to thedevicename & ” OSC ” & q default name of theselectedcue
set theindex to theindex + theincrement
end repeat
end try
end tell

When the script is run, it firsts requests information which isn’t included in the the template cue.

Number of cues to generate

The starting value for the index variable Increment between variables in subsequent cues

Whether whole number cue values should be formatted as 1 or 1.0

A name to appear before the values in the Q list name field.

It  checks the template cue is a valid format, and copies the Destination Patch to use in generated cues.

It then makes a new OSC cue with a custom message.

It removes any automatically generated cue number that QLab provides.

It then assembles the custom message using a rather nifty routine to substitute the current index value for the character string $$$. It does this by setting the text item delimiters to $$$ which means that applescript will treat the string as 2 text items separated by $$$. We then set the text item delimiter to the index value which means that applescript now sees the string as 2 text items separated by our index value. When the custom message is set to the item list string it reverts to just being treated as a single string again

The Q list name is then generated to include as much information as possible.

The process is repeated for the number of cues that are set to be generated in the first dialog incrementing the variable by the increment each time.

QLab Format OSC

The QLab format OSC cue is a cue that produces a standard OSC message for the control of QLab, usually running on a separate machine on the network.

The template cue is used to set  the Destination patch. the starting cue number and the QLab command.

Qlab OSC template

Here’s the script for the script cue in the group:

display dialog “Number of cues to generate:” default answer “100”
if button returned of result = “cancel” then
return
else
set therepeat to (text returned of result) as integer
end if
display dialog “Increment?” default answer “1”
if button returned of result = “cancel” then
return
else
set theincrement to (text returned of result) as real
end if
display dialog “Integer value format” buttons {“1”, “1.0”} default button “1”
set integertype to button returned of result
display dialog “Device Name for Q Name Text:” default answer “”
if button returned of result = “cancel” then
return
else
set thedevicename to (text returned of result) as string
end if
tell application id “com.figure53.qlab.3” to tell front workspace
if the osc message type of cue “QSCT” is not qlab then
display dialog “This generator only makes lists from QLab OSC messages”
return
end if
set theindex to q_num of cue “QSCT” as real
set the thedestinationpatch to patch of cue “QSCT”
repeat therepeat times
make type “OSC”
set theselectedcue to last item of (selected as list)
if theindex mod 1 is 0 and integertype is “1” then
set the q_num of theselectedcue to (theindex as integer) as string
else
set the q_num of theselectedcue to theindex as string
end if
set the q number of theselectedcue to “”
set the patch of theselectedcue to thedestinationpatch
set the osc message type of theselectedcue to qlab
set the q name of theselectedcue to thedevicename & ” QLab OSC ” & q default name of theselectedcue
set theindex to theindex + theincrement
end repeat
end tell

When the script is run, it firsts requests information which isn’t included in the the template cue.

Number of cues to generate Increment between cue numbers in subsequent cues

Whether whole number cue values should be formatted as 1 or 1.0

A name to appear before the values in the Q list name field.

It then checks the template cue is a valid format, and copies the Destination Patch to use in generated cues.

It copies the  cue number to use as the starting value and the Qlab Command e.g start, stop, etc It then makes a new OSC cue with a  message formatted for QLab.

It removes any automatically generated cue number that QLab provides.

The Q list name is then generated to include as much information as possible.

The process is repeated for the number of cues that are set to be generated in the first dialog incrementing the cue number  by the increment each time.

MSC (MIDI Show Control) The MSC cue is an option in the standard MIDI cue that produces a standard MSC message.

The template cue is used to set  the Destination patch. the starting cue number and the Command Format and Command and the deviceID number:

MSC

The cue number is used as the starting cue number. If required by your device a Q List and Q Path can also be specified in the template cue.

Here’s the script for the script cue in the group:

set thecommandnamelist to {“GO”, “STOP”, “RESUME”, “TIMED_GO”, “LOAD”, “SET”, “FIRE”, “ALL_OFF”, “RESTORE”, “RESET”, “GO_OFF”}
display dialog “Number of cues to generate:” default answer “100”
if button returned of result = “cancel” then
return
else
set therepeat to (text returned of result) as integer
end if
display dialog “Increment?” default answer “1”
if button returned of result = “cancel” then
return
else
set theincrement to (text returned of result) as real
end if
display dialog “Integer value format” buttons {“1”, “1.0”} default button “1”
set integertype to button returned of result
display dialog “Device Name for Q Name Text:” default answer “”
if button returned of result = “cancel” then
return
else
set thedevicename to (text returned of result) as string
end if
tell application id “com.figure53.qlab.3” to tell front workspace
set theindex to q_number of cue “MSCT” as real
set the thedestinationpatch to patch of cue “MSCT”
set thedeviceID to deviceID of cue “MSCT”
set thecommandformat to the command format of cue “MSCT”
set thecommandnumber to the command number of cue “MSCT”
if thecommandnumber is less than 12 then
set thecommandname to item thecommandnumber of thecommandnamelist
else
display dialog “Sorry can’t generate a list with that command”
return
end if
set theqlist to the q_list of cue “MSCT”
set theqpath to the q_path of cue “MSCT”
repeat therepeat times
make type “MIDI”
set theselectedcue to last item of (selected as list)
set the q number of theselectedcue to “”
set the patch of theselectedcue to thedestinationpatch
set the message type of theselectedcue to msc
set the command format of theselectedcue to thecommandformat
set the command number of theselectedcue to thecommandnumber
set the deviceID of theselectedcue to thedeviceID
if theindex mod 1 is 0 and integertype is “1” then
set the q_number of theselectedcue to (theindex as integer) as string
else
set the q_number of theselectedcue to theindex as string
end if
set the q_list of theselectedcue to theqlist as string
set the q_path of theselectedcue to theqpath as string
set the q name of theselectedcue to thedevicename & ” MSC (deviceID” & thedeviceID & “) ” & thecommandname & ” ” & the q_number of theselectedcue
set theindex to theindex + theincrement
end repeat
end tell

When the script is run, it first makes a list of all the possible MSC commands, which is used in the Q name of the generated cues to make the function of the MSC cue clearer.

It then requests information which isn’t included in the the template cue.

Number of cues to generate

Increment between cue numbers in subsequent cues

Whether whole number cue values should be formatted as 1 or 1.0

A name to appear before the values in the Q list name field.

It then checks the template cue is a valid format, and copies the Destination Patch to use in generated cues.

It copies the  cue number to use as the starting value and the  Command, Command Format, DeviceID, Q list, and Q path values.

It then makes a new MSC cue with a custom message.

It removes any automatically generated cue number that QLab provides.

The Q list name is then generated to include as much information as possible.

The process is repeated for the number of cues that are set to be generated in the first dialog incrementing the cue number  by the increment each time.

MIDI Program Change

The MIDI Program change is one of the MIDI messages that can be sent as a standard MIDI voice message from a MIDI cue.

The template cue is used to set  the Destination patch and  the MIDI Channel number:

MIDI PC

The Program Number  is used as the starting Program number Here’s the script for the script cue in the group:

set theMIDIrangelist to {“MIDI PC 0 selects Preset 1 on Device (0-127)”, “MIDI PC 1 selects Preset 1 on Device (1-128)”}
set theoffset to (choose from list theMIDIrangelist with title “MIDI PC Numbering” with prompt “What Program Change Range does your device use?” default items {“MIDI PC 0 selects Preset 1 on Device (0-127)”})
if theoffset = false then
return
else if theoffset = “MIDI PC 0 selects Preset 1 on Device (0-127)” then
set theoffset to 0
else
set theoffset to 1
end if
display dialog “Number of cues to generate:” default answer “100”
if button returned of result = “cancel” then
return
else
set therepeat to (text returned of result) as integer
end if
display dialog “Device Name for Q Name Text:” default answer “”
if button returned of result = “cancel” then
return
else
set thedevicename to (text returned of result) as string
end if
set theincrement to 1
tell application id “com.figure53.qlab.3” to tell front workspace
set theindex to byte one of cue “MPCT”
set the thedestinationpatch to patch of cue “MPCT”
set themidichannel to channel of cue “MPCT”
repeat therepeat times
make type “MIDI”
set theselectedcue to last item of (selected as list)
set the q number of theselectedcue to “”
set the q name of theselectedcue to thedevicename & ” (ch” & themidichannel & “)” & ” PRESET ” & (theindex + theoffset) as string
set the patch of theselectedcue to thedestinationpatch
set the message type of theselectedcue to voice
set the command of theselectedcue to program_change
set channel of theselectedcue to themidichannel
set byte one of theselectedcue to theindex as integer
set theindex to theindex + theincrement
end repeat
end tell

MIDI program change messages are always in the range 0-127, but there are 2 standards in common use for what preset on a device, e.g a Mixer, corresponds to MIDI PC 0. On some devices MIDI PC 0 will trigger Preset 0 and on others e.g  Yamaha DM series and 01v mixers,  it will trigger  Preset 1.

When the script is run, it first asks which of these standards your device follows.

It then requests information which isn’t included in the the template cue.

Number of cues to generate

There is no increment dialog for the MIDI program change cue generator as it assumes you want to generate a sequential  set of presets.

Similarly the MIDI values are always going to be whole numbers.

A  dialog asks for a device name to appear before the values in the Q list name field.

It then checks the template cue is a valid format, and copies the Destination Patch to use in generated cues.

It copies the  program change  number to use as the starting value and the  MIDI channel number.

It then makes a new MIDI Program change, voice cue.

It removes any automatically generated cue number that QLab provides.

The Q list name is then generated to include as much information as possible.

The process is repeated for the number of cues that are set to be generated in the first dialog incrementing the Program Change number  by the increment each time.

The example workspace can be downloaded for QLab 3 here

The example workspace can be downloaded for QLab 4 here

 

3D Model Chapter Graphic by Mic Pool ©2015 All rights reserved

MenuGraphic