AppleScript cue creation not working – no error but no cue created (QLab 5, macOS Tahoe 26.2)

127 views
Skip to first unread message

Gérard Naziri (Gerri)

unread,
Feb 17, 2026, 6:11:10 PM (6 days ago) Feb 17
to QLab

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

  • QLab 5 is running and frontmost.
  • No TCC permission prompt appears (even after tccutil reset AppleEvents).
  • Dictionary is loaded in Script Editor.
  • Same result on three different Macs (M1 Studio, MacBook Pro 2019, Trash Can).

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!


micpool

unread,
Feb 17, 2026, 6:18:03 PM (6 days ago) Feb 17
to QLab
Hmm

I don't understand how that script would compile. I suspect it's slop churned out by ChatGPT or similar. 

This works:

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


Rich Walsh

unread,
Feb 17, 2026, 6:26:29 PM (6 days ago) Feb 17
to ql...@googlegroups.com
This has never worked in QLab:

set newCue to make new cue

Where did you get that syntax from?

The form has always been:

make type "Video"
set newCue to last item of (selected as list)

Gérard Naziri (Gerri)

unread,
Feb 19, 2026, 7:15:30 PM (4 days ago) Feb 19
to QLab
Hi guys,

thank you for the quick replies. You are right, it's AI I tried to solve to problem with. I tried so much that I finally lost track of what I already tested and what not. I thought I also did make type "video" but maybe I just didn't. 

But now everything works finde. The script does what I like it to. 

I just want to refine one last thing but failed. I want to control the midi message type of a trigger for our MA lighting desk. And here is why:
My script sets the midi note number to the same number as the cue number. Which is fine until you reach cue 127. This is why I want to switch for note on to note off commands when reaching cue number 100. At 200 I like to switch to program change and so on.

The problem: SkriptEditor doesn't like midi message type. I get this when trying to compile: "Expected property but found identifier“ or „Can't follow this identifier“ (translated it from German). 

I don't exactly understand why because midi message type exists in the Dictionary. 

Any idea how to fix this? Is the code wrong? Or is it impossible to use midi message type? Is there a workaround? What would you suggest.

If you have an idea how to make the 100/200/400 change possible I'm listening. I just didn't want to do it with velocity because I already use it this for .x cue numbers like 1.1, 1.2, 1.3 etc. And the logic would get destroyed when using it also for the hundreds. 

Any suggestions? 

Here is my code:

set midi trigger to enabled

if rawInt ≤ 100 then
set b1 to rawInt
try
set midi message type to note_on
on error
-- Letzter Rettungsweg: Direkte Klassen-Adressierung falls Dictionary hakt
set its midi message type to note_on
end try
else if rawInt ≤ 200 then
set b1 to rawInt - 100
set its midi message type to note_off
else if rawInt ≤ 300 then
set b1 to rawInt - 200
set its midi message type to program_change
else if rawInt ≤ 400 then
set b1 to rawInt - 300
set its midi message type to control_change
else if rawInt ≤ 500 then
set b1 to rawInt - 400
set its midi message type to key_pressure
else
set b1 to rawInt - 500
set its midi message type to channel_pressure
end if

if b1 < 1 then set b1 to 1
if b1 > 127 then set b1 to 127
set its midi byte one to b1

if (rawInt ≤ 200) or (rawInt > 300 and rawInt ≤ 500) then
if b2 < 0 then set b2 to 0
set its midi byte two to b2
end if
end tell

Thank you,
Gérard 

micpool

unread,
Feb 20, 2026, 4:54:12 AM (4 days ago) Feb 20
to QLab
My first question would be, why are you using Musical MIDI messages to control a MA lighting desk when it's perfectly capable of receiving Midi Show Control, which would allow you any cue numbers?

If there is a reason, this script is the basis for what you want to do.

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

end tell 

Gérard Naziri (Gerri)

unread,
Feb 20, 2026, 12:38:58 PM (4 days ago) Feb 20
to QLab
Hi micpool,

why not MSC? The short answer is: tradition.

The longer one is…
we do not control every video cue by the light department. Technically we could, but it is not always practical. 

It begins with the numbering method. When the video cue numbers have to be the same as the lighting cue numbers it gets confusing. Not only for the operator but the video artist who might have his own method. Very soon no one knows what video has which number.

Then there might be cues where the video operator reads a score and has to fire the cues manually. These cues must not have lighting cue numbers. But how do you name then? There would be another logic for these manual cues which also leads to confusion when operators change.

Maybe for all that MSC could be somehow made practical but we feel that we have more control with Musical Midi Messages. 

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")

I guess I need to switch from any to a specific channel before I can change the midi message type. Right? I even thought about using only the channels to define cue numbers over 100, 200 and so one and forget about the midi message type. But I can't find the AppleScript command or property to switch a channel. "Set channel to 1" or "set properties to {channel:1, command:note_on, byte one:60} doesn't work. Is there a hidden property that must be set first to unlock the command or properties? 

Thank you!
Gérard

micpool

unread,
Feb 20, 2026, 3:56:10 PM (3 days ago) Feb 20
to QLab
On Friday, February 20, 2026 at 5:38:58 PM UTC ger...@add-it.de wrote:

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")

A video cue doesn't have a command parameter so it can't be set to any.

If you were trying to apply the script to a video cue I assume that you are triggering QLab from the MA lighting console and not as I assumed from your post

I want to control the midi message type of a trigger for our MA lighting desk

using QLab to  Trigger your MA console.

If this is the case then the script you want is:

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

Screen Recording 2026-02-20 at 20.52.26.mov

micpool

unread,
Feb 20, 2026, 3:58:15 PM (3 days ago) Feb 20
to QLab
Example Workspace attached (uses memo cues but will work with any cue type including video

No error checking for non-numeric cue numbers!

Set triggers of selected cues based on q number.qlab5

Gérard Naziri (Gerri)

unread,
Feb 20, 2026, 8:54:07 PM (3 days ago) Feb 20
to QLab
Hey Mic, 

oh wow, what a service. Thank you so much for all your efforts to help a complete scripting newbie. And sorry for the misunderstanding. I indeed meant that QLab is triggered by the MA as you found out by yourself. 

And yes, your script was the missing part to get to a solution. The basic script is ready now and with one click it creates 3 cues to fade in a new video and stop the old one, numbers in the logic of the sequence with only the video cue getting a number, activates Midi Triggers to get triggered and everything with an internal logic so that automatically new cues within two integer numbers get point-numbers (with the according logic for midi triggers using velocity values). This is created only by one click in MetaGrid Pro.

And now with your help I can even go up to 600 (or 627) cues for a show. Thank you so much.

Switching midi message types is a possible way to get to these high cue numbers when using Musical Midi Messages. I think more elegantly would be when using midi channels for that. It's not so much mental gymnastics for the MA operator when just using numbers instead of special midi terms he has to remember. I spent as always hours to find out what the right syntax for this is. We (which is me and the AI) couldn't find out. No idea where you find all these hidden commands. We couldn't. The AI calls you Holy Grail now.

Thanks again for the support.
Gérard

micpool

unread,
Feb 21, 2026, 12:54:39 AM (3 days ago) Feb 21
to QLab
Glad you now  have this working.
However,  I don’t understand why you think all the commands and parameters for scripting QLab are hidden. They are clearly documented in the QLab AppleScript,dictionary


And there are numerous examples in the documentation.


This Google group is also searchable, and many common scripting tasks have been discussed here with example code.There are also numerous  posts discussing how best to learn Applescript, and more recently discussions about why AI tools are possibly the worst way to try and script QLab.

Creating scripts with the complexity of your requirements is best done in Script Editor which is an app which is part of the MacOS. This allows you to access the QLab dictionary from its file menu, and also gives far clearer error messages when you are developing code.

In addition to QLab specific terms you also need to understand some basic number and string handling techniques specific to Applescript. For instance you wanted to create MIDI triggers with data based on the cue number. To decide which message type or Midi channel  a MIDI triggers would use, and to process the cue numbers to be converted  into integers that can be accepted inthe data bytes of MIDi triggers you needed to treat QLab's cue numbers as real numbers, when actually they are strings,  But then you  needed  to process the modified cue numbers as a string in order to extract 2 integers, to put into the 2 Midi Data bytes, which are the 2 numbers either side of the decimal point in the  cue numbers  text string.

That’s why there are lines of script that convert strings to numbers and numbers to text,  and lines which split the strings into the parts either side of the decimal point, using Applescript’s Text Delimiters.

You also needed to deal with the fact that your cues might be numbered with  text strings containing   just an integer, e.g “142”. or an integer and a single digit after the decimal point, e.g “123.3” or an integer and two digits after the decimal point e.g “146.38”

In a fully bomb proof script you would also add in scripting to deal with the fact that some cues could have cue numbers that either accidentally or intentionally were not strings just containing numbers and a single decimal point, e.g “fred.1.A” which is a perfectly legitimate QLab cue number

In all these cases you needed to process text strings into 2 integers within the acceptable range of the 2 Midi Bytes of a QLab MIDI triggers.

All these things really made it unlikely that an AI tool was going to write a working script for you!

Mic

micpool

unread,
Feb 21, 2026, 7:33:13 AM (3 days ago) Feb 21
to QLab
I think more elegantly would be when using midi channels for that. It's not so much mental gymnastics for the MA operator when just using numbers instead of special midi terms he has to remember.

I agree that using MIDI channels for the Hundreds of the q number is a better t solution. As you have control over your Cue numbers, its probably best to only use cue numbers for your video cues between 100 and 1699.99 as if you rely on the LX Programmer to add 1 to the hundreds when programming the MIDI channel, there is a strong likelihood of error. Having the MIDI channel number correspond exactly to the hundreds of the cue number makes the relationship between cue number and MIDI trigger  completely obvious.

As it was fairly trivial to change my previous script  to use MIDI channels instead of different MIDI commands and to add some rudimentary error checking, here's my final version:

--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


Mic

Gérard Naziri (Gerri)

unread,
Feb 22, 2026, 9:12:21 PM (2 days ago) Feb 22
to QLab
Holy Mic,
I think I owe you money now. Thank you so much. You provide me with factory ready scripts with no charge (up until now). I hope you also have some magic scripts that help you write them in less than a minute. Otherwise I would feel quite bad. 

Although my numbering logic is different I could use your method and safety checks to make a code that not only compiles but is understood by QLab. Thank you very much.

To your statement about AI: 

I knew you would say that. And I know you are absolutely right. But you know what, a week ago I didn't even know that what I do now is possible. I didn't have anything and now I have a MetaGrid Pro Controller for QLab Programming. In a socio-political, philosophical and cognitive perspective I think AI is not only a danger but will change our lives forever. And I fear in a quite dystopian way. But most likely this forum is not the place to discuss this.

Anyway I thank you for supporting me. Without you input I wouldn't have scripts now that can do complete Video Cues with Cue Numbering and Midi Trigger incl. Safety Checks, Group Cues, toggle Trigger, Loop or Hold at End check boxes for several cues at once, marking cues, Fade Times for several cues at ones.

There is one scripts I am thinking of that I couldn't realise yet. 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. I'm not sure if my code is flawed or if QLab doesn't allow it because of security reasons. 

Is there a way to scan this list or should I forget about it and just keep doing that in QLab?

Thanks a lot again!
Gérard

micpool

unread,
Feb 23, 2026, 3:19:39 PM (10 hours ago) Feb 23
to QLab
On Monday, February 23, 2026 at 2:12:21 AM UTC ger...@add-it.de wrote:
 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.

A quick and dirty way to scan the stages into a list, to use in a choose from dialog, is to make a disarmed dummy text  cue numbered "stagesMenu" and then put this script on a hotkey (or run from MetaGrid):

--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

Screen recording attached

Select from Stages.mov
Reply all
Reply to author
Forward
0 new messages