set inRun to false
tell application id "com.figure53.QLab.5" to tell front workspace
set selectedCues to (selected as list)
repeat with eachcue in selectedCues
if the continue mode of eachcue is do_not_continue then
if inRun is true then --this is the last cue in the run of autocontinue/follows
set inRun to false
set thisPreWait to pre wait of eachcue
set pre wait of eachcue to accumWait + thisPreWait
set post wait of eachcue to 0
move cue id (uniqueID of eachcue) of (parent of eachcue) to end of newGroup
end if
else
if inRun is false then --this is the first cue in the run of autocontinue/follows
set inRun to true
set accumWait to 0
--create the group. It will temporarily be after the first cue in the auto run
set tempSelection to {}
copy eachcue to end of tempSelection
set selected to tempSelection
make type "Group"
set newGroup to last item of (selected as list)
set mode of newGroup to timeline
end if
set thisPreWait to pre wait of eachcue
set pre wait of eachcue to accumWait + thisPreWait
if the continue mode of eachcue is auto_follow then
set thisPostWait to duration of eachcue
else
set thisPostWait to post wait of eachcue
end if
set post wait of eachcue to 0
move cue id (uniqueID of eachcue) of (parent of eachcue) to end of newGroup
set accumWait to accumWait + thisPreWait + thisPostWait
end if
end repeat
set selected to selectedCues
end tell
tell application id "com.figure53.QLab.5" to tell front workspace
set selectedCues to selected as list
repeat with eachGroup in selectedCues
if q type of eachGroup is "Group" and mode of eachGroup is timeline then
set sortedChildren to my sortCues(cues of eachGroup as list)
set lastPrewait to 0
set eachGroupUniqueID to uniqueID of eachGroup
set eachGroupParent to parent of eachGroup
repeat with eachCue in sortedChildren
--compute the new prewait
set currentPrewait to pre wait of eachCue
set newPrewait to currentPrewait - lastPrewait
--move the cue
move cue id (uniqueID of eachCue) of eachGroup to before cue id (eachGroupUniqueID) of eachGroupParent
--assign the new prewait
set pre wait of eachCue to newPrewait
set post wait of eachCue to 0
set continue mode of eachCue to auto_continue
set lastPrewait to currentPrewait
end repeat
set continue mode of eachCue to do_not_continue --fix the continue mode of the last cue in the run
delete cue id (eachGroupUniqueID) of eachGroupParent
end if
end repeat
end tell
on sortCues(cueList)
tell application id "com.figure53.QLab.5" to tell front workspace
set theIndexList to {}
set theSortedList to {}
repeat (length of cueList) times
set theLowItem to ""
repeat with a from 1 to (length of cueList)
if a is not in theIndexList then
set theCurrentItem to item a of cueList
if theLowItem is "" then
set theLowItem to theCurrentItem
set theLowItemIndex to a
else if pre wait of theCurrentItem < pre wait of theLowItem then
set theLowItem to theCurrentItem
set theLowItemIndex to a
end if
end if
end repeat
set end of theSortedList to theLowItem
set end of theIndexList to theLowItemIndex
end repeat
return theSortedList
end tell
end sortCues
tell application id "com.figure53.QLab.5" to tell front workspace
set selectedCues to (selected as list)
set tempSelection to {}
copy item 1 of selectedCues to end of tempSelection
set selected to tempSelection
make type "Group"
set newGroup to last item of (selected as list)
repeat with eachcue in selectedCues
move cue id (uniqueID of eachcue) of (parent of eachcue) to end of newGroup
end repeat
end tell
tell application id "com.figure53.QLab.5" to tell front workspace
set selectedCues to selected as list
repeat with eachGroup in selectedCues
if q type of eachGroup is "Group" and mode of eachGroup is timeline then
repeat with eachCue in cues of eachGroup as list
move cue id (uniqueID of eachCue) of eachGroup to before cue id (uniqueID of eachGroup) of (parent of eachGroup)
end repeat
end if
end repeat
end tell
tell application id "com.figure53.QLab.5" to tell front workspace to move cue id (uniqueID of first cue of current cue list) of current cue list to end of current cue list
On 31 Aug 2023, at 19:44, James Lo <revers...@gmail.com> wrote:
For ungroupingtell application id "com.figure53.QLab.5" to tell front workspaceset selectedCues to selected as listrepeat with eachGroup in selectedCuesif q type of eachGroup is "Group" and mode of eachGroup is timeline thenrepeat with eachCue in cues of eachGroup as listmove cue id (uniqueID of eachCue) of eachGroup to before cue id (uniqueID of eachGroup) of (parent of eachGroup)end repeatend ifend repeatend tellI start with a single group with one child cue
<from group.png>and run the script
<to run.png>When I undo twice I get
--
Contact support anytime: sup...@figure53.com
Follow QLab on Twitter: https://twitter.com/QLabApp
User Group Code of Conduct: https://qlab.app/code-of-conduct/
---
You received this message because you are subscribed to the Google Groups "QLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qlab+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/01c8f0e7-7a1a-4b6a-8e6a-5d9f114a328fn%40googlegroups.com.
<from group.png><to run.png><workspace w one group.qlab5><undo to empty group.png>
set theGroup to the first cue whose q number is theGroupNumber
set theGroup to cue theGroupNumber