--Go Workspace (and disable any MIDI cues in a timeline group prior to load to time)
--Hijack Space Bar (Clear GO key in Settings/Controls/Keyboard/GO)
--Use Space Bar and/or set MIDI triggers or send OSC to trigger the cue containing this script, to GO workspace
set aFlag to false
tell application id "com.figure53.QLab.5" to tell front workspace
set theCue to playhead of front cue list
if theCue is missing value then
return 1
end if
if q type of theCue is not "group" then
go
return 2
end if
if q type of theCue is "group" and mode of theCue is not timeline then
go
return 3
end if
if running of theCue is true or paused of theCue then
go
return 4
end if
--if cue is not running or paused and is a Timeline Group Cue then do all this stuff
set theMIDICues to cues of theCue whose q type is "midi"
if the action elapsed of theCue is not 0 then --cue is not running or paused and is a Timeline Group Cue and is loaded to time.
--disarm any MIDI cues in the timeline group cue that are before the 'load to time' time
repeat with eachCue in theMIDICues
if (pre wait elapsed of eachCue) = (pre wait of eachCue) then --MIDI cue is before 'load to time' time
set the armed of eachCue to false
else --MIDI cue is after 'load to time' time
set the armed of eachCue to true
end if
end repeat
else --cue is not running or paused and is a Timeline Group Cue and is NOT loaded to time so will play from beginning
set aFlag to true
repeat with eachCue in theMIDICues
set the armed of eachCue to true
end repeat
end if
go
delay 0.5
--if cues in the timeline group have been disarmed then arm them again.
if aFlag is false then
repeat with eachCue in theMIDICues
set the armed of eachCue to true
end repeat
end if
end tell
tell application id "com.figure53.QLab.5" to tell front workspace
set armed of every cue whose q type is "MIDI" and pre wait < loadTime to false
end tell
-- disarm cues with pre wait less than load time
-- run this script a Hotkey trigger
tell application id "com.figure53.QLab.5" to tell front workspace
-- set a default load time
set loadTime to 7
set cueType to "MIDI" -- couuld use this for Network OSC triggers
-- get the selected cue ..
set myGroup to first item of (selected as list)
-- .. check if its a group or parent is group and use that
if q type of myGroup is not "Group" then
if q type of parent of myGroup is "Group" then
set myGroup to parent of myGroup
else
-- otherwise return an error
display dialog "please select a cue in a timeline group" with title "Error"
return
end if
end if
if mode of myGroup is not timeline then
display dialog "please select a timeline group" with title "Error"
return
end if
-- reset previously disarmed cues
set armed of cues whose parent is myGroup and q type is cueType to true
stop myGroup
-- ask the user for load time
set loadTime to text returned of (display dialog "Load at time" default answer loadTime with title (q display name of myGroup as string))
load myGroup time loadTime
-- disarm cues with pre wait before the load time
set armed of every cue whose q type is cueType and pre wait < loadTime to false
start myGroup
end tell
The essence of this problem can be done in one linetell application id "com.figure53.QLab.5" to tell front workspace
set armed of every cue whose q type is "MIDI" and pre wait < loadTime to false
end tell
--Go Workspace (and disable any MIDI cues in a timeline group prior to load to time)
--by Mic Pool. Nested Group handling based on a script by Rich Walsh.
--CONTAINS ADDITIONAL CODE FOR NESTED GROUPS
--Hijack Space Bar (Clear GO key in Settings/Controls/Keyboard/GO)
--Use Space Bar and/or set MIDI triggers or send OSC to trigger the cue containing this script, to GO workspace
set aFlag to false
tell application id "com.figure53.QLab.5" to tell front workspace
set theCue to playhead of front cue list
if theCue is missing value then
return 1
end if
if q type of theCue is not "group" then
go
return 2
end if
if q type of theCue is "group" and mode of theCue is not timeline then
go
return 3
end if
if running of theCue is true or paused of theCue then
go
return 4
end if
--if cue is not running or paused and is a Timeline Group Cue then do all this stuff
set cuesToProcess to cues of theCue
set containedIDs to {} -- We need to check for nested cues that are already selected so as not to add them twice; lists of "cues" can't be compared, only of IDs
repeat with eachCue in cuesToProcess
set end of containedIDs to uniqueID of eachCue
end repeat
set i to 0
repeat until i = (count containedIDs)
set eachID to item (i + 1) of containedIDs
set eachCue to cue id eachID
if q type of eachCue is "Group" then
repeat with eachChild in cues of eachCue
set childID to uniqueID of eachChild
if childID is not in containedIDs then
set end of cuesToProcess to eachChild -- Cue is not already selected, so add it for processing
set end of containedIDs to childID
end if
end repeat
end if
set i to i + 1
end repeat
if the action elapsed of theCue is not 0 then --cue is not running or paused and is a Timeline Group Cue and is loaded to time.
--disarm any MIDI cues in the timeline group cue that are before the 'load to time' time
set cuesToProcess to cues of theCue
set containedIDs to {} -- We need to check for nested cues that are already selected so as not to add them twice; lists of "cues" can't be compared, only of IDs
repeat with eachCue in cuesToProcess
set end of containedIDs to uniqueID of eachCue
end repeat
set i to 0
repeat until i = (count containedIDs)
set eachID to item (i + 1) of containedIDs
set eachCue to cue id eachID
if q type of eachCue is "Group" then
repeat with eachChild in cues of eachCue
set childID to uniqueID of eachChild
if childID is not in containedIDs then
set end of cuesToProcess to eachChild -- Cue is not already selected, so add it for processing
set end of containedIDs to childID
end if
end repeat
end if
set i to i + 1
end repeat
repeat with eachCue in cuesToProcess
if q type of eachCue is "midi" then
if (pre wait elapsed of eachCue) = (pre wait of eachCue) then --MIDI cue is before 'load to time' time
set the armed of eachCue to false
else --MIDI cue is after 'load to time' time
set the armed of eachCue to true
end if
end if
end repeat
else --cue is not running or paused and is a Timeline Group Cue and is NOT loaded to time so will play from beginning
set aFlag to true
repeat with eachCue in cuesToProcess
if q type of eachCue is "midi" then
set the armed of eachCue to true
end if
end repeat
end if
go
delay 0.5
--if cues in the timeline group have been disarmed then arm them again.
if aFlag is false then
repeat with eachCue in cuesToProcess
if q type of eachCue is "midi" then
set the armed of eachCue to true
end if
end repeat
end if
end tell
Is there a way to hijack the "enter" key to paste the (light) cue number I type in MSC settings as the name for this cue ?
-- Hijack the GO mechanism and disarm certain cues if loaded past when a cue has been loaded to time
-- Concept by Mic Pool
set userCueTypes to {"Network", "MIDI", "Start"} -- Choose which cue types to disarm
set userZeroLengthOnly to true -- Choose whether to only disarm cues with zero duration
tell application id "com.figure53.QLab.5" to tell front workspace
set theCue to playhead of current cue list
if theCue is missing value then -- Mic's suite of criteria to see if GO should just behave normally
return
else if running of theCue or paused of theCue then
go
return
else if q type of theCue is not "Group" then
go
return
else if mode of theCue is not timeline then
go
return
else if action elapsed of theCue is 0 then
go
return
end if
set cuesToProcess to cues of theCue
set processedIDs to {}
set i to 0
repeat until i = (count cuesToProcess)
set eachCue to item (i + 1) of cuesToProcess
set eachType to q type of eachCue
if eachType is "Group" then -- Recursively add nested Groups
set cuesToProcess to cuesToProcess & cues of eachCue
else if eachType is in userCueTypes then -- Only process specific cue types
if not userZeroLengthOnly or duration of eachCue is 0 then
if pre wait elapsed of eachCue = pre wait of eachCue then -- Mic's clever test for if a cue is loaded past
if armed of eachCue then -- Only change state of armed cues (ie: protect any other edits already done)
set armed of eachCue to false
set end of processedIDs to uniqueID of eachCue
end if
end if
end if
end if
set i to i + 1
end repeat
go
delay 0.5 -- Wait a moment before resetting; also acts as debounce
repeat with eachID in processedIDs -- Reset the cues that were touched
set armed of cue id eachID to true
end repeat
end tell