Toggle Group Cue Collapse / Expand via script / MIDI

89 views
Skip to first unread message

Tim Fox

unread,
Nov 20, 2025, 12:42:49 AM (4 days ago) Nov 20
to QLab
Hi All,
Hope you're all well, and the End of Year panto gods are treating you kindly.

I've got a little aliexpress Go button usb / midi controller, and wanted to assign a button to expand or collapse the selected group. ie. 

If cue expanded:
    collapse group
else
   expand
end-if

Am I correct in thinking this isn't possible via a script assigned to the MIDI trigger?

/cue/selected/collapse & /cue/selected/expand would be the commands, but what would the query / test be in the if statement in the script to determine which command to fire? 

Cheers,
Tim,

Message has been deleted

micpool

unread,
Nov 20, 2025, 4:33:45 AM (4 days ago) Nov 20
to QLab
On Thursday, November 20, 2025 at 8:34:04 AM UTC micpool wrote:

In QLab 5.2 and later you can append /toggle to an OSC command

Unfortunately, this doesn't work unless the OSC address accepts a boolean argument, so this doesn't work for collapse expand. I have deleted my previous amswer

Mic

Tim Fox

unread,
Nov 20, 2025, 4:39:03 AM (4 days ago) Nov 20
to QLab
Hi Mike, thanks for taking the time.
Yeah, was just thinking that, you beat me to it.

I'm actually even stumbling before that.
Screenshot 2025-11-20 at 8.30.48 pm.png

This works OK with Shift-Y to fire cue 1 when selected, so it's not a hotkey issue

However this doesnt expand when I have cue 1 highlighted.

Screenshot 2025-11-20 at 8.33.01 pm.png

I also tried /cue/1/expand.

What am I missing?

Cheers!
Tim

micpool

unread,
Nov 20, 2025, 4:49:54 AM (4 days ago) Nov 20
to QLab
On Thursday, November 20, 2025 at 9:39:03 AM UTC timm...@gmail.com wrote:

However this doesnt expand when I have cue 1 highlighted.

Screenshot 2025-11-20 at 8.33.01 pm.png

I also tried /cue/1/expand.



That should work fine.

Workspace and screen recording attached 
collapse expand.qlab5
Screen Recording 2025-11-20 at 09.48.31.mov

Rich Walsh

unread,
Nov 20, 2025, 5:09:28 AM (4 days ago) Nov 20
to ql...@googlegroups.com
I’m not sure I’d actually use them (to be honest, with the way I program, I don’t need to see inside Group Cues during show running…) but here are two imperfect options:

-- Only works if Group Cues are numbered


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

set selectedCue to last item of (selected as list)

set selectedCueNumber to q number of selectedCue

if q type of selectedCue is "Group" and selectedCueNumber is not "" then

tell application "System Events" to tell (first application process whose bundle identifier is "com.figure53.QLab.5") to set cueDescription to description of first row of outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of splitter group 1 of window 1 whose description begins with ("cue " & selectedCueNumber)

if cueDescription contains "collapsed" then

expand selectedCue

else

collapse selectedCue

end if

end if

end tell


Or:

-- Only works if playhead is locked to selection


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

set selectedCue to last item of (selected as list)

if q type of selectedCue is "Group" then

tell application "System Events" to tell (first application process whose bundle identifier is "com.figure53.QLab.5") to set cueDescription to description of first row of outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of splitter group 1 of window 1 whose description contains "playback position"

if cueDescription contains "collapsed" then

expand selectedCue

else

collapse selectedCue

end if

end if

end tell


The only things I could find that change when the display state of a Group Cue changes are the “description” and “accessibility description” properties of the UI element…

I don’t guarantee these will work at all except on the specific workspace I just tested on this machine! I also only tested from Script Editor, not via a Script Cue with a hotkey.

Rich

Tim Fox

unread,
Nov 20, 2025, 5:11:32 AM (4 days ago) Nov 20
to QLab
Well that's super weird. Downloaded your workspace (only using demo to access network cues at the moment), and copied your config using 1 and 2 as the trigger keys into my demo workspace. And that worked fine.
Changed the tigger back to Shift-Y and Shift-U, and that worked too. Very strange.

Anyhoo, back to the original problem.
Mike do you think a script something like this is worth a go? 

If select cue is not a group cue
    stop
end-if

Store the group_cue_name

Move to the next visible cue.

If cue highlighted now is part of the same group_cue_name
    collapse
else
    scroll back up one cue
    expand
end-if

Paul

unread,
Nov 20, 2025, 6:45:23 AM (4 days ago) Nov 20
to QLab
The problem is that you cannot read the collapsed / expanded status of a Group cue, only set it. So unless you used convoluted user interface program (as in Rich's example) or keep track of the expanded status (as in Mic's example) you can;t test for expanded/collapsed in an if statement. So you can't use one button/trigger as a toggle but you need two.
I would generally collapse all group cues when show running, so only the top level cues - the ones that are called - show. And when editing open the groups I was editing at the time, using the keyboard short cuts < and >


Tim Fox

unread,
Nov 20, 2025, 7:27:43 AM (4 days ago) Nov 20
to QLab
Yep, that's the issue alright.

I'm having a play with this logic:

Count number of displayed cues
If cue is not a group, get the parent and select
try collapse
if the number of displayed lined has not changed assume the group was already collapsed, so try expand.

Currently stuck with the last test. The script is always expanding, so the new_count isn't changing if the group cue collapsed.
Where does the count of cues come from? What is displayed in the main window, or what is displayed in the List / Cart area? (if its the latter, then that's why the sount doesnt change... 

-- 5) recount displayed cues
set new_count to (count of (cues of current cue list))

-- 6) if nothing changed, expand the group back
if new_count = starting_count then
try
expand targetCue
end try
end if


Paul

unread,
Nov 20, 2025, 7:43:41 AM (4 days ago) Nov 20
to QLab
count of cues in current cue list
just counts the cues in the current cue list - the cues are still there even when they are hidden inside a collapsed group. You cannot count what is displayed without doing user interface programming (see Rich's reply above).

micpool

unread,
Nov 20, 2025, 8:08:34 AM (4 days ago) Nov 20
to QLab
count of cues of current cue list is the number of direct child cues of the cue list and as Paul says is the same regardless of whether those cues are visible or not.

Screenshot 2025-11-20 at 13.06.13.png

In this cue list the count of cues of the current cue list is 2
The count of cues of cues 1 and 6 is 4
This is true regardless of what is displayed.



Mic

micpool

unread,
Nov 20, 2025, 8:46:55 AM (4 days ago) Nov 20
to QLab
Rich's scripts work well for this.

The UI scripting gets the following description from a cue that is expanded and is at the playhead

cue 1, Group cue, unnamed, 4 children, expanded, duration 0, playback position

 And this from a cue that is collapsed and is not at the playhead

cue 6, Group cue, unnamed, 4 children, collapsed, duration 0




micpool

unread,
Nov 20, 2025, 8:57:28 AM (4 days ago) Nov 20
to QLab
On Thursday, November 20, 2025 at 10:11:32 AM UTC timm...@gmail.com wrote:
 do you think a script something like this is worth a go? 

If select cue is not a group cue
    stop
end-if

Store the group_cue_name

Move to the next visible cue.

If cue highlighted now is part of the same group_cue_name
    collapse
else
    scroll back up one cue
    expand
end-if

That approach would work, although your pseudo-code is a few steps removed from the actual script required

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

try

set theCue to last item of (selected as list)

if the q type of theCue is "group" then

moveSelectionDown

set theNextDisplayed to last item of (selected as list)

moveSelectionUp

if the parent of theNextDisplayed is theCue then

collapse theCue

else

expand theCue

end if

end if

end try

end tell


Screen recording and workspace attached

toggle expand collapse.qlab5
Screen Recording 2025-11-20 at 13.54.29.mov

Tim Fox

unread,
Nov 20, 2025, 11:10:19 PM (3 days ago) Nov 20
to QLab
OK, think I've got it.  :)


-- There's four types of cues that need to be considered. (A) 'Top level' cues not part of a group, (B) cues part of a group, (C) collapsed group cues, (D) expanded group cues.

-- Behavior:

--  * If the selected cue is not a Group, check it's parent:

--   If it's parent is of type "group"  then it we can collapse it (B)

--   - Otherwise it's at top level (the parent type will be a "List"), so do nothing. (A)

--  * If the selected cue is a Group:

--   - Check the next cue on the list. Grab it's parent, and if that matches the cue we started on, then the group was already expanded (D), so collapse it

--   - Otherwise, the cue we started on must have been a collapsed group (C), so we can expand it.


tell application id "com.figure53.QLab.5"

tell front workspace

set selectedCue to last item of (selected as list)

if q type of selectedCue is not "Group" then

set selectedCueParent to parent of selectedCue

if q type of selectedCueParent is "Group" then

collapse selectedCueParent

set selected to selectedCueParent

return

else

set selected to selectedCue

return

end if

end if

if q type of selectedCue is "Group" then

moveSelectionDown

set nextCue to last item of (selected as list)

try

set nextCueParent to parent of nextCue

on error

set nextCueParent to missing value

display dialog "Missing parent. Weird..." buttons {"OK"} default button "OK"

end try

if nextCueParent is not missing value and (uniqueID of nextCueParent) is (uniqueID of selectedCue) then

collapse selectedCue

set selected to selectedCue

return

else

expand selectedCue

set selected to selectedCue

return

end if

end if

end tell

end tell




Reply all
Reply to author
Forward
0 new messages