Here are some AppleScript scripts that might be helpful for QLab 3. Most are updates and improvements to existing scripts. All work nicely with QLab 3.1.11. All should be associated with hotkeys.
Set color for selected cues
This script allows you to select multiple cues and quickly set the color for all of them.
Notice that there are two colors that are not included in the standard QLab choices. Qlab seems to offer yellow in addition to the familiar orange. And it colors anything that it doesn't recognize as grey - so I made that a choice as well.
This script - and most of those below - uses a hack to send plain text OSC to QLab itself. OSC allows you to do things that are either more difficult or - as far as I know, impossible - with AppleScript alone. It works perfectly, even if it is a little less than elegant!
-- Set color for selected cues
-- Tim Rogers <timmrogers@gmail.com>
-- Help and inspiration from https://figure53.hostedwiki.co/pages/QLab%20Scripts%20and%20Macros
-- Updated to use OSC /cue/selected syntax
tell application id "com.figure53.qlab.3" to tell front workspace
set myColor to choose from list {"none", "blue", "green", "grey",
"orange", "purple", "red", "yellow"} with title "Color" with prompt "Select
color for selected cues" default items "none"
set myOSC to "/cue/selected/colorName " & myColor
do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
end tell
Edit target of video or audio cues
Edit target of video or audio cues
-- Edit target audio or image file for selected cue
-- Tim Rogers <timmrogers@gmail.com>
-- Original script by Rich Walsh at
https://figure53.hostedwiki.co/pages/QLab%20Scripts%20and%20Macros
-- TODO - Extend to edit other file types
-- Set audio editor (Audacity or Ocenaudio should work nicely as well)
set myAudioApplication to application "Fission"
-- Set image editor
set myImageApplication to application "Pixelmator"
tell application id "com.figure53.qlab.3" to tell front workspace
set selectedCue to last item of (selected as list)
if q type of selectedCue is "Audio" then
set fileTarget to file target of selectedCue
ignoring application responses
tell myAudioApplication
open fileTarget
activate
end tell
end ignoring
end if
if q type of selectedCue is "Video" then
set fileTarget to file target of selectedCue
tell application "Finder" to set {myFileType, myNameExt}
to ({file type, name extension} of file fileTarget)
if (myNameExt is "gif") or (myNameExt is "jpg")
or (myNameExt is "png") then
ignoring application responses
tell myImageApplication
open fileTarget
activate
end tell
end ignoring
end if
end if
end tell
Show total time for selected cues
No more estimating the total length of the audio files for pre-show or intermission music. Just select them and press the hot-key that you have associated with this script!
--Created by Michael Portrie <mportrie@gmail.com>
-- Updated by Tim Rogers <timmrogers@gmail.com>
tell application id "com.figure53.qlab.3" to tell front workspace
set totalSeconds to 0
set thisSeconds to 0
repeat with eachCue in (selected as list)
try
set thisSeconds to (duration of eachCue)
set totalSeconds to thisSeconds + totalSeconds
end try
end repeat
set h to totalSeconds div 3600
set s to totalSeconds - h * 3600
set m to s div 60
set s to s - m * 60
if h < 10 then
set h to text -2 thru -1 of ("00" & h)
else
set h to h as text
end if
if m < 10 then set m to text -2 thru -1 of ("00" & m)
if s < 10 then set s to text -2 thru -1 of ("00" & s)
set prettySeconds to (h & ":" & m & ":" & s)
display dialog "The total time of the selected cues is "
& prettySeconds with title "Total Time" with icon 1
end tell
Patch selected cues
-- Patch selected cues
-- Tim Rogers <timmrogers@gmail.com>
-- Updated to use OSC /cue/selected syntax
tell application id "com.figure53.qlab.3" to tell front workspace
display dialog "Type new patch number (1-16 for OSC cues, 1-8 for
Audio, Mic, MIDI, and Video cues)" with title "New Patch Number" with icon 1
default answer ""
try
set myPatch to (text returned of result) as number
on error
display alert "Invalid patch number" message "Please enter a
valid patch number."
return
end try
set myOSC to "/cue/selected/patch " & myPatch
do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
end tell
Make selected cues louder or softer
-- Make selected cues louder (Shift+>)
-- Tim Rogers <timmrogers@gmail.com>
tell application id "com.figure53.qlab.3" to tell front workspace
set myOSC to "/cue/selected/level/0/0/+ 1"
do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
end tell
-- Make selected cues softer (Shift+<)
-- Tim Rogers <timmrogers@gmail.com>
tell application id "com.figure53.qlab.3" to tell front workspace
set myOSC to "/cue/selected/level/0/0/- 1"
do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
end tell
Make slideshow from selected cues
-- Create slideshow from selected cues
-- Tim Rogers <timmrogers@gmail.com>
tell application id "com.figure53.qlab.3" to tell front workspace
display dialog "Enter the number of seconds between cues:" with title "Cues"
with icon 1 default answer "10"
try
set myPostWait to (text returned of result) as number
on error
display alert "Invalid number" message "Please enter a valid number."
return
end try
set mySelected to (selected as list)
set myCount to (count mySelected)
repeat with myCurrentCue in mySelected
-- Get the uniqueID of the current cue
set myID to uniqueID of myCurrentCue
-- Move the selection to the current cue
tell the current cue list
set playback position to cue id myID
end tell
-- Set opacity and continue mode of the current cue
set opacity of myCurrentCue to 0
set continue mode of myCurrentCue to auto_continue
-- If first selected cue
if myCurrentCue's contents is the first item of mySelected then
-- Make new fade cue
make type "Fade"
-- and find its name
set myNewCueList to selected
set myNewCue to last item of myNewCueList
-- and set its target, opacity, and post wait
set cue target of myNewCue to myCurrentCue
set opacity of myNewCue to 100
set do opacity of myNewCue to true
set post wait of myNewCue to myPostWait
set continue mode of myNewCue to auto_continue
-- Set previous cue
set myPreviousCue to myCurrentCue
-- Otherwise
else
-- Make new fade cue
make type "Fade"
-- and find its name
set myNewCueList to selected
set myNewCue to last item of myNewCueList
-- and set its target and opacity
set cue target of myNewCue to myCurrentCue
set opacity of myNewCue to 100
set do opacity of myNewCue to true
set continue mode of myNewCue to auto_continue
-- Make new fade-and-stop cue
make type "Fade"
-- and find its name
set myNewCueList to selected
set myNewCue to last item of myNewCueList
-- and set its target, opacity, post wait, and stop
set cue target of myNewCue to myPreviousCue
set opacity of myNewCue to 0
set do opacity of myNewCue to true
set post wait of myNewCue to myPostWait
set stop target when done of myNewCue to true
set continue mode of myNewCue to auto_continue
-- Set previous cue
set myPreviousCue to myCurrentCue
end if
end repeat
end tell