Hi everyone,
I'm trying to create cues (video, fade, stop) with AppleScript from MetaGrid Pro on iPad, triggered by a button. The script runs without any error message (tested in Script Editor, VS Code, and osascript in Terminal), but no new cue appears in QLab.
Example minimal script that compiles and runs but does nothing visible:
tell application id "com.figure53.QLab.5"
tell front workspace
set newCue to make new cue
tell newCue
set q type to "video"
set opacity to 0.0
end tell
display dialog "Cue created"
end tell
end tell
Other users seem to use similar make new cue syntax successfully, so I'm wondering what I'm missing. Is there a setting in QLab 5 or macOS Tahoe that silently blocks make commands? Or is this a known issue?
Any help or workaround would be greatly appreciated – thanks!
tell application id "com.figure53.QLab.5" to tell front workspace
make type "video"
set newCue to last item of (selected as list)
set opacity of newCue to 0.0
display alert "Cue created"
end tell
set newCue to make new cue
make type "Video"
set newCue to last item of (selected as list)
tell application id "com.figure53.QLab.5" to tell front workspace
set theCues to (selected as list)
repeat with eachCue in theCues
if the q number of eachCue as integer is less than 100 then
set the command of eachCue to note_on
set the byte one of eachCue to the q number of eachCue as integer
else
set the command of eachCue to note_off
set the byte one of eachCue to the (q number of eachCue as integer) - 100
end if
end repeat
Thank you for your code. AppleScript can compile it. But now I have a problem with QLab: "QLab got an error: command of video cue can’t be set to any." (Or: "can't be set to note_on")
tell application id "com.figure53.QLab.5" to tell front workspace
set theCues to (selected as list)
repeat with eachCue in theCues
set theNumber to (q number of eachCue)
set theNum to theNumber as number
if theNum is less than 100 then
set the midi command of eachCue to note_on
else if theNum ≥ 100 and theNum < 200 then
set the midi command of eachCue to note_off
set theNum to theNum - 100
else if theNum ≥ 200 and theNum < 300 then
set the midi command of eachCue to control_change
set theNum to theNum - 200
end if
set theNumber to theNum as text
set theTids to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set theInt to text item 1 of theNumber as number
try
set theDec to text item 2 of theNumber as number
on error
set theDec to 0
end try
set AppleScript's text item delimiters to theTids
set the midi byte one of eachCue to theInt
set the midi byte two of eachCue to theDec
set the midi trigger of eachCue to enabled
end repeat
end tell
If you are using point cues then you can't use Program change triggers as they only use Mid Byte One
Screen recording attached
--set a MIDI trigger for a cue based on it's cue number
--Will handle numerically numbered cues between 100 and 1699.99 with up to 2 decimal places
--MIDI Ch is hundreds Note on: Note Number is tens and units Velocity is decimals
--Trigger for Q101.5 is MIDI Ch 1/ Note On/ Note Number 1/ Velocity 5
--Trigger for Q234 is MIDI Ch 2/ Note On/ Note Number 34/ Velocity 0
--Trigger for Q1623.99 is MIDI Ch 16/ Note On/ Note Number 23/ Velocity 99
tell application id "com.figure53.QLab.5" to tell front workspace
set theCues to (selected as list)
repeat with eachCue in theCues
if the q number of eachCue is "" then
display alert " A selected Cue is not numbered"
return
end if
try
set theNumber to (q number of eachCue)
set theNum to theNumber as number
on error
display alert "A selected cue is not numbered or its cue number is not a number"
return
end try
if theNum is less than 100 or theNum is greater than 1699.99 then
display alert "A selected Cue has a Cue Number that is not between 100 and 1699.99"
return
end if
set the midi trigger channel of eachCue to theNum div 100
set theNum to theNum - (theNum div 100) * 100
set theNumber to theNum as text
set theTids to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set theInt to text item 1 of theNumber as number
try
set theDec to text item 2 of theNumber as number
on error
set theDec to 0
end try
if (count theDec as text) > 2 then
display alert " A selected cue has more than 2 decimal places in its cue number"
return
end if
set AppleScript's text item delimiters to theTids
set the midi command of eachCue to note_on
set the midi byte one of eachCue to theInt
set the midi byte two of eachCue to theDec
set the midi trigger of eachCue to enabled
end repeat
end tell
I like to change the Stage of several cues at once. I know this is possible just in QLab itself. But I'd like to push a button in MetaGrid Pro for it. I could save at least one click to go to the I/O tab and just keep working in the Geometry Tab. What I have is that I can input the name of the Stage and QLab switches the Output to this Stage. But what I'd like to have ist a pop-up window on the Mac with all Stages of the project to choose from by clicking on it. I couldn't make it work because QLab didn't allow to scan the list.
--set the stage of selected cues to a stage selected from a list
set theStagesList to {}
set theMax to 10 --maximum number of stages polled.
set theLastName to ""
tell application id "com.figure53.QLab.5" to tell front workspace
repeat with theStage from 0 to theMax
log theStage
set the stage number of cue "stagesMenu" to (theStage as integer)
set theStageName to (get stage name of cue "stagesMenu")
if theStageName is not theLastName then
if theStageName is "status:error" then set theStageName to "unpatched"
set the end of theStagesList to theStageName
set theLastName to theStageName
end if
end repeat
set theStageOption to (choose from list theStagesList) as text
set theCues to (selected as list)
repeat with eachCue in theCues
if the q type of eachCue is in {"video", "camera", "text"} then
if theStageOption is "unpatched" then
set the stage number of eachCue to 0
else
set the stage name of eachCue to theStageOption
end if
end if
delay 0.1
end repeat
--force correct display
set the selected to {}
set the selected to theCues
end tell
1