Scripting to create Midi Cues within a group cue

54 views
Skip to first unread message

Ben Rivers

unread,
Sep 23, 2025, 6:52:49 PM (3 days ago) Sep 23
to QLab
Hi,

I am constantly creating midi cues to change scenes on the desk which requires a midi program change cue and a midi control change cue. 

Is it possible to create a script that can create both these cues with a dialog box for the desk (or midi) number, and put them within a group cue (with dialog box to label the group)

micpool

unread,
Sep 24, 2025, 2:21:01 AM (2 days ago) Sep 24
to QLab

https://qlab.app/cookbook/show-control-cues-generator/

Can be adapted for most  cue generation purposes

Rich Walsh

unread,
Sep 24, 2025, 8:58:12 AM (2 days ago) Sep 24
to ql...@googlegroups.com
This will also make more or less anything you need in terms of MIDI messages: https://wiki.allthatyouhear.com/doku.php?id=home#go_ahead_make_midi. You need to change all the "qlab.4” to “qlab.5” for it to run in QLab 5.

As I said in this thread: https://groups.google.com/g/qlab/c/Rj28YztyFxE/m/rgwUGnpjAAAJ, my approach would be to make all the possible messages in advance in a separate cue list and then just make a Start Cue when you need one. Easy then to batch correct, say, the MIDI channel later.

The business part for you is the “else” after "if commandType is not "CC00/PC” then”, essentially make a group, make a control change message and move it into the group, make a program change message and move that into the group, name as required. Moving cues it is a bit easier in more recent QLab 5 versions, but I think the classic approach should still work.

Rich

Paul

unread,
Sep 24, 2025, 11:12:30 AM (2 days ago) Sep 24
to QLab
Like Rich suggests it would be sensible to have the MIDI cues created in separate cue list and use Start cues in your main cue list. That way if you move to a sound desk which has different recall scene commands, you can keep your main cue list and substitute the list with the new MIDI commands.
Here is a solution which creates the group with MIDI PC and CC cues in a separate cue list, on the fly if they don't already exist, and makes Start cue in your originating ("main") cue list.  
It is quite unusual to have a desk which requires both PC and CC to recall scenes, so that part may need to be tweaked to get it to work with your particular desk.

-- Make Start and MIDI CC and PC cues to control sound desk

--   put this on a hot key trigger


-- the cue number prefix for group cues in control list (and target cue number of start cues)

set prefix to "Sc"

-- adjust these values to suit

set MIDIpatchNum to 1 -- the Qlab MIDI patch for output

set MIDIchannel to 2 -- MIDI channel the receiver is listening on

set controlNumber to 5 -- for CC MIDI cue, the control number needed by your sound desk

-- this is the name of the cue list where the midi cues will be created

--  if it doesn't exist it will be created

set midiCuelistName to "Desk Control"


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

set nl to linefeed

set selCue to last item of (selected as list)

set myCuelist to current cue list

--display dialog (q display name of selCue) & nl & (q name of myCuelist) as string with title "Starting position"

set nextSceneNum to ""

set sceneNum to text returned of (display dialog "Enter the scene number" default answer nextSceneNum with title "MIDI scene recall of sound desk")

try

set recallCueNum to prefix & sceneNum

set targetCue to cue recallCueNum

on error

set myCuelist to current cue list

-- make midi cues as they don't exist

try

set midiCuelist to first cue list whose q name is midiCuelistName

set current cue list to midiCuelist

on error errMesg

set response to (display dialog "Cue list does not exist " & linefeed & errMesg as string with title midiCuelistName buttons {"Cancel", "Create Cuelist"} default button "Create Cuelist")

if button returned of response is "Create Cuelist" then

make type "cue list"

set midiCuelist to first cue list whose q name is "Cue List"

set q name of midiCuelist to midiCuelistName

set current cue list to midiCuelist

end if

end try

make type "group"

set groupCue to last item of (selected as list)

-- make midi cues 

set midiPCcue to my makeMIDI(MIDIpatchNum, MIDIchannel)

set command of midiPCcue to program_change

set midiCCcue to my makeMIDI(MIDIpatchNum, MIDIchannel)

set command of midiCCcue to control_change

-- may need to modify this depending on the sound desk

set byte one of midiPCcue to sceneNum

set byte one of midiCCcue to controlNumber

set ControlValue to sceneNum -- may need to change depending on sound desk

set byte two of midiCCcue to ControlValue

-- move both midi cues into the group

move cue id (uniqueID of midiPCcue) of parent of midiPCcue to end of groupCue

move cue id (uniqueID of midiCCcue) of parent of midiCCcue to end of groupCue

-- set the cue number of the group cue - this will be the target of the Start cue

set q number of groupCue to recallCueNum

set q name of groupCue to "recall scene " & sceneNum

collapse midiCuelist

-- revert back to the cue list we were working in

set current cue list to myCuelist

end try

make type "Start"

set startcue to last item of (selected as list)

set cue target of startcue to cue recallCueNum --midiGroupCue

-- move the start cue to after the currently selected cue [script must be on hotkey]

move cue id (uniqueID of startcue) of parent of startcue to after selCue

set selected to startcue

end tell


on makeMIDI(MIDIpatchNum, MIDIchannel)

--

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

make type "MIDI"

set midiCue to last item of (selected as list)

--  MIDI cue parameters

set midi patch number of midiCue to MIDIpatchNum

set channel of midiCue to MIDIchannel

-- MIDI types can be Voice (note, CC, Prog Change etc), MSC (MIDI Show Control) or SysEx (System Exclusive)

set message type of midiCue to voice

return midiCue

end tell

end makeMIDI


Reply all
Reply to author
Forward
0 new messages