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


However this doesnt expand when I have cue 1 highlighted.I also tried /cue/1/expand.
-- 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
-- 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

cue 6, Group cue, unnamed, 4 children, collapsed, duration 0
do you think a script something like this is worth a go?If select cue is not a group cuestopend-ifStore the group_cue_nameMove to the next visible cue.If cue highlighted now is part of the same group_cue_namecollapseelsescroll back up one cueexpandend-if
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
-- 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