├── .gitignore ├── 00 Adapted from others └── 12 Sam Schloegel │ ├── 01 Levels │ └── Select cues which cues use output x.applescript │ ├── 02 Tech Rehearsals │ └── Load Parent Group to start of selected Child.applescript │ └── 03 Stems │ ├── Target version bump by filename.applescript │ └── Target version bump by folder.applescript ├── 00 Desk Control ├── LS9CustomFaderAssign.applescript ├── LS9FaderLevel.applescript ├── LS9OnCue.applescript ├── LS9SendToMix.applescript └── LS9_midi_control.py ├── 00 Import all to library.applescript ├── 00 Import scripts as links.applescript ├── 00 Import scripts to cues.applescript ├── 00 List of available colours for cues.md ├── 00 Retrieve metadata headers.applescript ├── Applescript Utilities.applescript ├── Control ├── Convert Eos OSC cues to MSC.applescript ├── Create A&H Midi Cue.applescript ├── Create OSC control cue.applescript └── Set midi trigger of selected cue.applescript ├── Cue Lists ├── Add new section heading.applescript ├── Create locate cue in Main Cue List.applescript └── Create start cue in Main Cue List.applescript ├── Cue Tools ├── ArmDisarm through dialog.applescript ├── Put selected cue(s) in a new group cue.applescript ├── Put selected cue(s) in a new group with notes & number.applescript ├── Set autoload off.applescript ├── Set autoload on.applescript ├── Set target to the cue above.applescript ├── Toggle ARMING.applescript ├── Turn off infinite loop.applescript └── Turn on infinite loop.applescript ├── Fades ├── Create fade in.applescript ├── Create fade out.applescript └── Create fade.applescript ├── Files ├── Label files in use.applescript ├── Reveal target audio file in finder.applescript └── Save New Version.applescript ├── LICENSE ├── Levels ├── Bump level.applescript └── Set crosspoints to current default.applescript ├── Mixing Desk Programming ├── Choose Desk to program.applescript ├── Create CLQL scene recall with name.applescript ├── Create CLQL scene recall.applescript ├── Create GLDSQ scene recall with name.applescript ├── Create GLDSQ scene recall.applescript ├── Create PM scene recall with name.applescript ├── Create PM scene recall.applescript └── Offset midi triggers of selected cues.applescript ├── README.md ├── Routing ├── Route Soundcheck tracks to template.applescript ├── Route click tracks to channels.applescript ├── Route tracks to template.applescript ├── Set crosspoints to template.applescript ├── Set gangs to template.applescript └── WIP - Automatically route click tracks.applescript ├── SFX Variations ├── Create Selection cue in a separate cue list.applescript ├── Create a variant SFX from audio files.applescript └── Create link to select playback variants in rig check.applescript ├── Soundcheck ├── Create Spoken Line Check Cues.applescript ├── Line Check Audio Files │ ├── Sub v1.wav │ ├── Sub v2.wav │ └── Sub.RPP └── Speaker Polarity Check.applescript └── Tech Rehearsals ├── Locate to Reaper Marker.applescript ├── Move to cut list.applescript ├── Preset To Before Next Cue.applescript ├── Preset desk to before next cue.applescript ├── Select cues that loop infinitely.applescript └── Start the loop of selected cue.applescript /.gitignore: -------------------------------------------------------------------------------- 1 | # These are some examples of commonly ignored file patterns. 2 | # You should customize this list as applicable to your project. 3 | # Learn more about .gitignore: 4 | # https://www.atlassian.com/git/tutorials/saving-changes/gitignore 5 | 6 | # Node artifact files 7 | node_modules/ 8 | dist/ 9 | 10 | # Compiled Java class files 11 | *.class 12 | 13 | # Compiled Python bytecode 14 | *.py[cod] 15 | 16 | # Log files 17 | *.log 18 | 19 | # Package files 20 | *.jar 21 | 22 | # Maven 23 | target/ 24 | dist/ 25 | 26 | # JetBrains IDE 27 | .idea/ 28 | 29 | # Unit test reports 30 | TEST*.xml 31 | 32 | # Generated by MacOS 33 | .DS_Store 34 | 35 | # Generated by Windows 36 | Thumbs.db 37 | 38 | # Applications 39 | *.exe 40 | *.war 41 | 42 | # Large media files 43 | *.mp4 44 | *.tiff 45 | *.avi 46 | *.flv 47 | *.mov 48 | *.wmv 49 | 50 | -------------------------------------------------------------------------------- /00 Adapted from others/12 Sam Schloegel/01 Levels/Select cues which cues use output x.applescript: -------------------------------------------------------------------------------- 1 | -- @description Select cues which use output x 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Sam Schloegel 5 | -- @version 1.0 6 | -- @testedmacos 10.13.6 7 | -- @testedqlab 4.6.9 8 | -- @about Of the selection, leaves only cues selected which are routed to a particular output 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.0 + init 13 | 14 | 15 | -- USER DEFINED VARIABLES ----------------- 16 | 17 | set userThresh to -60 18 | 19 | ---------- END OF USER DEFINED VARIABLES -- 20 | 21 | 22 | -- RUN SCRIPT ----------------------------- 23 | 24 | tell application id "com.figure53.Qlab.4" to tell front workspace 25 | set theSelection to (selected as list) 26 | set theList to {} 27 | set theOut to (display dialog "Which cue output?" default answer "1" buttons {"Cancel", "Go"} default button "Go") 28 | 29 | if button returned of theOut is "Go" and text returned of theOut is not "" then 30 | set theOut to (text returned of theOut as integer) 31 | repeat with eachCue in theSelection 32 | if q type of eachCue is in {"Audio", "Fade", "Mic"} and ((getLevel eachCue row 0 column theOut) > userThresh) then 33 | set end of theList to eachCue 34 | end if 35 | end repeat 36 | set selected to theList 37 | display alert ((length of theList as string) & " of " & (length of theSelection as string) & " cues were found and selected") 38 | 39 | end if 40 | end tell -------------------------------------------------------------------------------- /00 Adapted from others/12 Sam Schloegel/02 Tech Rehearsals/Load Parent Group to start of selected Child.applescript: -------------------------------------------------------------------------------- 1 | -- @description Load parent group to start of selected child 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Sam Schloegel 5 | -- @version 1.0 6 | -- @testedmacos 10.13.6 7 | -- @testedqlab 4.6.9 8 | -- @about When cues are programmed in timeline groups, this script loads the group to the time of the start of the selected cue within the group 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.0 + init 13 | 14 | 15 | -- USER DEFINED VARIABLES ----------------- 16 | 17 | set userPreRoll to 0.0 18 | 19 | ---------- END OF USER DEFINED VARIABLES -- 20 | 21 | 22 | -- RUN SCRIPT ----------------------------- 23 | 24 | tell application id "com.figure53.Qlab.4" to tell front workspace 25 | set theCue to last item of (selected as list) 26 | set thePre to pre wait of theCue 27 | set theParent to parent of theCue 28 | load theParent time (thePre - userPreRoll) 29 | set playback position of parent list of theParent to cue id (uniqueID of theParent) 30 | end tell -------------------------------------------------------------------------------- /00 Adapted from others/12 Sam Schloegel/03 Stems/Target version bump by filename.applescript: -------------------------------------------------------------------------------- 1 | -- @description Target version bump by filename 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Sam Schloegel 5 | -- @version 1.0 6 | -- @testedmacos 10.13.6 7 | -- @testedqlab 4.6.9 8 | -- @about Retargets selected cues (intended for use with click track stems) from version xx to version xx+1 in the same folder 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.0 + init 13 | 14 | 15 | -- USER DEFINED VARIABLES ----------------- 16 | 17 | set versionLength to 2 -- How many digits for versioning? v1 / v01, 2 digits recommended 18 | 19 | ---------- END OF USER DEFINED VARIABLES -- 20 | 21 | 22 | -- RUN SCRIPT ----------------------------- 23 | 24 | tell application id "com.figure53.Qlab.4" to tell front workspace 25 | set theSelection to (selected as list) 26 | repeat with eachCue in theSelection 27 | if q type of eachCue is "Audio" then 28 | set theName to q name of eachCue 29 | -- Get POSIX path of current target 30 | set theTarget to (file target of eachCue) 31 | set theTarget to the POSIX path of theTarget 32 | 33 | set lastChars to text -6 thru -1 of theTarget 34 | set thePos to ((6 - ((offset of "." in lastChars) - 2)) * -1) 35 | set theExt to text (offset of "." in lastChars) thru -1 of lastChars 36 | set theTrunk to text 1 thru thePos of theTarget 37 | set oldVersion to (text (versionLength * -1) thru -1 of theTrunk) as integer 38 | set newVersion to (oldVersion + 1) as string 39 | if (count newVersion) < versionLength then 40 | set leadingNeeded to versionLength - (count newVersion) 41 | repeat leadingNeeded times 42 | set newVersion to ("0" & newVersion) 43 | end repeat 44 | end if 45 | set newTarget to ((text 1 thru (-1 - versionLength) of theTrunk) & newVersion & theExt) 46 | 47 | set file target of eachCue to (POSIX file newTarget) 48 | end if 49 | end repeat 50 | end tell 51 | -------------------------------------------------------------------------------- /00 Adapted from others/12 Sam Schloegel/03 Stems/Target version bump by folder.applescript: -------------------------------------------------------------------------------- 1 | -- @description Target version bump by folder 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Sam Schloegel 5 | -- @version 1.0 6 | -- @testedmacos 10.13.6 7 | -- @testedqlab 4.6.9 8 | -- @about Retargets selected cues (intended for use with click track stems) to files with the same names in a different, user defined folder 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.0 + init 13 | 14 | 15 | -- USER DEFINED VARIABLES ----------------- 16 | 17 | set versionLength to 2 -- How many digits for versioning? v1 / v01 18 | 19 | -- Do not use slashes in your filenames 20 | 21 | ---------- END OF USER DEFINED VARIABLES -- 22 | 23 | 24 | -- RUN SCRIPT ----------------------------- 25 | 26 | tell application id "com.figure53.Qlab.4" to tell front workspace 27 | set theSelection to (selected as list) 28 | 29 | set theFolder to the POSIX path of (choose folder with prompt "lead me to your files") 30 | 31 | repeat with eachCue in theSelection 32 | if q type of eachCue is "Audio" then 33 | set theName to q name of eachCue 34 | -- Get POSIX path of current target 35 | set theTarget to (file target of eachCue) 36 | set theTarget to the POSIX path of theTarget 37 | set reversed to reverse of characters of theTarget as string 38 | set fileName to text (1 - (offset of "/" in reversed)) thru -1 of theTarget 39 | set newTarget to theFolder & fileName 40 | set file target of eachCue to (POSIX file newTarget) 41 | end if 42 | end repeat 43 | 44 | end tell 45 | -------------------------------------------------------------------------------- /00 Desk Control/LS9CustomFaderAssign.applescript: -------------------------------------------------------------------------------- 1 | -- Creates a midi sysex cue to assign any fader to a specific custom fader 2 | -- Yamaha LS9-32 3 | -- change to preamble will change desk type, should work for modern desks 4 | -- but to be vereified 5 | -- 6 | -- Example string inputs: 7 | -- ch 7 to custom 3 -- channel 7 to -20db 8 | -- x to custom 10 9 | -- mono to custom 1 10 | -- accepted chan values: ch 1-64 ; mix 1-16 ; mt/mtrx 1-8 ; mono/sub 11 | -- accepoted custom fader values: custom 1 - 32 12 | -- 13 | -- author: t.streuli 14 | 15 | ------- Script -------- 16 | 17 | tell application id "com.figure53.Qlab.4" to tell front workspace 18 | 19 | display dialog "Enter Fader Level Control String" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER" 20 | set inputMsg to text returned of result 21 | 22 | set message to my faderString(inputMsg) 23 | 24 | -- Make the midi program cue 25 | make type "Midi" 26 | set midiBank to first item of (selected as list) 27 | set message type of midiBank to sysex 28 | set sysex message of midiBank to message 29 | set q name of midiBank to inputMsg 30 | 31 | end tell 32 | 33 | 34 | ---------- Functions ---------------- 35 | 36 | -- SYSEX midi string for given control string 37 | on faderString(inputMsg) 38 | set pre to "43 10 3E 12 01" 39 | set splitText to split(inputMsg, space) 40 | 41 | if length of splitText = 5 then 42 | set chan to item 1 of splitText 43 | set chanN to item 2 of splitText as integer 44 | set customN to item 5 of splitText as integer 45 | else 46 | set chan to item 1 of splitText 47 | set customN to item 4 of splitText as integer 48 | end if 49 | 50 | set customNumVal to hex(customN-1) 51 | 52 | -- channel type and number 53 | if chan = "x" then 54 | set chanNumVal to "0F 7F 7F 7F 7F" 55 | else if chan = "mono" or chan = "sub" then 56 | set chanNumVal to "00 00 00 00 62" 57 | else if chan = "ch" then 58 | set chanNumVal to "00 00 00 00 " & hex(chanN - 1) 59 | else if chan = "mix" then 60 | set chanNumVal to "00 00 00 00 " & hex(chanN + 71) 61 | else if chan = "mt" or chan = "mtrx" then 62 | set chanNumVal to "00 00 00 00 " & hex(chanN + 87) 63 | end if 64 | 65 | set msg to pre & " 02 2C 00 " & customNumVal & " 00 03 " & chanNumVal 66 | return msg 67 | end faderString 68 | 69 | 70 | -- splits text into list 71 | to split(someText, delimiter) 72 | set AppleScript's text item delimiters to delimiter 73 | set someText to someText's text items 74 | set AppleScript's text item delimiters to {""} 75 | return someText 76 | end split 77 | 78 | -- returns hex from an integer 79 | on hex(x) 80 | set val to do shell script "perl -e 'printf(\"%02X\", " & x & ")'" 81 | return val 82 | end hex -------------------------------------------------------------------------------- /00 Desk Control/LS9FaderLevel.applescript: -------------------------------------------------------------------------------- 1 | -- Creates a midi sysex cue to set the value of any fader to a given value 2 | -- Yamaha LS9-32 3 | -- change to preamble will change desk type, should work for modern desks 4 | -- but to be vereified 5 | -- 6 | -- Example string inputs: 7 | -- ch 7 to -20 -- channel 7 to -20db 8 | -- mix 16 to 1 -- mix 16 to +1db 9 | -- mtrx 4 out -- mtrx 4 to -inf db (if setting out/-inf NO NOT include 'to') 10 | -- 11 | -- accepted chan values: ch 1-64 ; st 1-4 ; mix 1-16 ; mt/mtrx 1-8 12 | -- accepoted db values: out/-Inf ; -137 -> +10 13 | -- 14 | -- author: t.streuli 15 | 16 | ------- Script -------- 17 | 18 | tell application id "com.figure53.Qlab.4" to tell front workspace 19 | 20 | display dialog "Enter Fader Level Control String" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER" 21 | set inputMsg to text returned of result 22 | 23 | set message to my faderString(inputMsg) 24 | 25 | -- Make the midi program cue 26 | make type "Midi" 27 | set midiBank to first item of (selected as list) 28 | set message type of midiBank to sysex 29 | set sysex message of midiBank to message 30 | set q name of midiBank to inputMsg 31 | 32 | end tell 33 | 34 | 35 | ---------- Functions ---------------- 36 | 37 | -- SYSEX midi string for given control string 38 | on faderString(inputMsg) 39 | set pre to "43 10 3E 12 01" 40 | set splitText to split(inputMsg, space) 41 | 42 | -- channel number 43 | set chan to item 1 of splitText 44 | set chanN to item 2 of splitText as integer 45 | if chan = "st" then 46 | set chanNumVal to hex(chanN * 2 + 62) 47 | else 48 | set chanNumVal to hex(chanN - 1) 49 | end if 50 | 51 | -- Hex value for channel type 52 | if chan = "ch" or chan = "st" then 53 | set chanType to hex(51) 54 | else if chan = "mix" then 55 | set chanType to hex(78) 56 | else if chan = "mt" or chan = "mtrx" then 57 | set chanType to hex(95) 58 | end if 59 | -- stereo master = 109, not checked or implimented 60 | 61 | -- fader value 62 | if length of splitText = 3 then 63 | set dbVal to item 3 of splitText 64 | if dbVal = "out" or dbVal = "-inf" then 65 | set value to "00 00" 66 | end if 67 | else if length of splitText is equal to 4 then 68 | set dbVal to item 4 of splitText as number 69 | set value to midiDbVal(dbVal) 70 | end if 71 | 72 | set msg to pre & " 00 " & chanType & " 00 00 00 " & chanNumVal & " 00 00 00 " & value 73 | return msg 74 | end faderString 75 | 76 | -- fader value as hex string 77 | on midiDbVal(d) 78 | if d > -138.0 and d <= -96.0 then 79 | set q to 47 + (d / 3) 80 | else if d > -96.0 and d <= -78.0 then 81 | set q to 111 + d 82 | else if d > -77.8 and d <= -40 then 83 | set q to 423 + d * 5 84 | else if d > -40 and d <= -20 then 85 | set q to 623 + d * 10 86 | else if d > -20 then 87 | set q to 823 + d * 20 88 | end if 89 | set q to round (q) 90 | 91 | set y to q div 128 as text 92 | set z to hex(q mod 128) 93 | 94 | set midiVal to "0" & y & " " & z 95 | return midiVal 96 | end midiDbVal 97 | 98 | -- splits text into list 99 | to split(someText, delimiter) 100 | set AppleScript's text item delimiters to delimiter 101 | set someText to someText's text items 102 | set AppleScript's text item delimiters to {""} 103 | return someText 104 | end split 105 | 106 | -- returns hex from an integer 107 | on hex(x) 108 | set val to do shell script "perl -e 'printf(\"%02X\", " & x & ")'" 109 | return val 110 | end hex -------------------------------------------------------------------------------- /00 Desk Control/LS9OnCue.applescript: -------------------------------------------------------------------------------- 1 | -- Creates a midi sysex cue to set the cue / on value of any channel 2 | -- Yamaha LS9-32 3 | -- change to preamble will change desk type, should work for modern desks 4 | -- but to be vereified 5 | -- 6 | -- Example string inputs: 7 | -- ch 7 on -- channel 7 on 8 | -- mix 16 off -- mix 16 off 9 | -- mtrx 4 cue -- mtrx 4 cue off 10 | -- 11 | -- accepted chan values: ch 1-64 ; st 1-4 ; mix 1-16 ; mt/mtrx 1-8 12 | -- accepoted control values: on ; off ; cue ; nocue 13 | -- 14 | -- author: t.streuli 15 | 16 | ------- Script -------- 17 | 18 | tell application id "com.figure53.Qlab.4" to tell front workspace 19 | 20 | display dialog "Enter Channel Control String" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER" 21 | set inputMsg to text returned of result 22 | 23 | set message to my faderString(inputMsg) 24 | 25 | -- Make the midi program cue 26 | make type "Midi" 27 | set midiBank to first item of (selected as list) 28 | set message type of midiBank to sysex 29 | set sysex message of midiBank to message 30 | set q name of midiBank to inputMsg 31 | 32 | end tell 33 | 34 | 35 | ---------- Functions ---------------- 36 | 37 | -- SYSEX midi string for given control string 38 | on faderString(inputMsg) 39 | set pre to "43 10 3E 12 01" 40 | set splitText to split(inputMsg, space) 41 | 42 | -- channel number 43 | set chan to item 1 of splitText 44 | set chanN to item 2 of splitText as integer 45 | if chan = "st" then 46 | set chanNumVal to hex(chanN * 2 + 62) 47 | else 48 | set chanNumVal to hex(chanN - 1) 49 | end if 50 | 51 | -- value and channel type 52 | set operation to item 3 of splitText 53 | if operation = "on" or operation = "cue" then 54 | set value to hex(1) 55 | else 56 | set value to hex(0) 57 | end if 58 | if operation = "on" or operation = "off" then 59 | if chan = "ch" or chan = "st" then 60 | set chanType to hex(49) 61 | else if chan = "mix" then 62 | set chanType to hex(76) 63 | else if chan = "mt" or chan = "mtrx" then 64 | set chanType to hex(93) 65 | end if 66 | set msg to pre & " 00 " & chanType & " 00 00 00 " & chanNumVal & " 00 00 00 00 " & value 67 | 68 | end if 69 | if operation = "cue" or operation = "nocue" then 70 | if chan = "ch" or chan = "st" then 71 | set chanType to hex(94) 72 | else if chan = "mix" then 73 | set chanType to hex(95) 74 | else if chan = "mt" or chan = "mtrx" then 75 | set chanType to hex(96) 76 | end if 77 | set msg to pre & " 01 " & chanType & " 00 00 00 " & chanNumVal & " 00 00 00 00 " & value 78 | end if 79 | 80 | return msg 81 | end faderString 82 | 83 | -- splits text into list 84 | to split(someText, delimiter) 85 | set AppleScript's text item delimiters to delimiter 86 | set someText to someText's text items 87 | set AppleScript's text item delimiters to {""} 88 | return someText 89 | end split 90 | 91 | -- returns hex from an integer 92 | on hex(x) 93 | set val to do shell script "perl -e 'printf(\"%02X\", " & x & ")'" 94 | return val 95 | end hex -------------------------------------------------------------------------------- /00 Desk Control/LS9SendToMix.applescript: -------------------------------------------------------------------------------- 1 | -- Creates a midi sysex cue to set the value of a fader's send to a mix 2 | -- Yamaha LS9-32 3 | -- change to preamble will change desk type, should work for modern desks 4 | -- but to be vereified 5 | -- 6 | -- Example string inputs: 7 | -- ch 7 to mix 5 at -20 -- send channel 7 to mix 5 at -20db 8 | -- 9 | -- accepted chan values: ch 1-64 10 | -- accepted mix values: mix 1-16 11 | -- accepoted db values: -inf ; -137 -> +10 12 | -- 13 | -- author: t.streuli 14 | 15 | ------- Script -------- 16 | 17 | tell application id "com.figure53.Qlab.4" to tell front workspace 18 | 19 | display dialog "Enter Fader Sent to Mix Control String" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER" 20 | set inputMsg to text returned of result 21 | 22 | set message to my faderString(inputMsg) 23 | 24 | -- Make the midi program cue 25 | make type "Midi" 26 | set midiBank to first item of (selected as list) 27 | set message type of midiBank to sysex 28 | set sysex message of midiBank to message 29 | set q name of midiBank to inputMsg 30 | 31 | end tell 32 | 33 | 34 | ---------- Functions ---------------- 35 | 36 | -- SYSEX midi string for given control string 37 | on faderString(inputMsg) 38 | set pre to "43 10 3E 12 01" 39 | set splitText to split(inputMsg, space) 40 | 41 | -- channel & mix number 42 | set chanN to item 2 of splitText as integer 43 | set chanNumVal to hex(chanN - 1) 44 | 45 | set mixN to item 5 of splitText as integer 46 | set mixNumVal to hex(mixN*3+2) 47 | 48 | -- send value value 49 | set dbVal to item 7 of splitText as number 50 | if dbVal = "-inf" then 51 | set value to "00 00" 52 | else 53 | set value to midiDbVal(dbVal) 54 | end if 55 | 56 | set msg to pre & " 00 43 00 " & mixNumVal & " 00 " & chanNumVal & " 00 00 00 " & value 57 | return msg 58 | end faderString 59 | 60 | -- fader value as hex string 61 | on midiDbVal(d) 62 | if d > -138.0 and d <= -96.0 then 63 | set q to 47 + (d / 3) 64 | else if d > -96.0 and d <= -78.0 then 65 | set q to 111 + d 66 | else if d > -77.8 and d <= -40 then 67 | set q to 423 + d * 5 68 | else if d > -40 and d <= -20 then 69 | set q to 623 + d * 10 70 | else if d > -20 then 71 | set q to 823 + d * 20 72 | end if 73 | set q to round (q) 74 | 75 | set y to q div 128 as text 76 | set z to hex(q mod 128) 77 | 78 | set midiVal to "0" & y & " " & z 79 | return midiVal 80 | end midiDbVal 81 | 82 | -- splits text into list 83 | to split(someText, delimiter) 84 | set AppleScript's text item delimiters to delimiter 85 | set someText to someText's text items 86 | set AppleScript's text item delimiters to {""} 87 | return someText 88 | end split 89 | 90 | -- returns hex from an integer 91 | on hex(x) 92 | set val to do shell script "perl -e 'printf(\"%02X\", " & x & ")'" 93 | return val 94 | end hex -------------------------------------------------------------------------------- /00 Desk Control/LS9_midi_control.py: -------------------------------------------------------------------------------- 1 | import math 2 | import time 3 | pre = "43 10 3E 12 01" 4 | print("LS9 MIDI SysEx Encoder") 5 | print("Which function do you need?") 6 | print("") 7 | 8 | def Midi(q): 9 | x = int(q) 10 | y = x//128 11 | z = format(x%128, '02X') 12 | if len(z) == 1: 13 | print("MIDI Value is: 0%d 0%s" %(y,z)) 14 | elif len(z) == 2: 15 | print("MIDI Value is: 0%d %s" %(y,z)) 16 | 17 | def Midi2(q): 18 | x = int(q) 19 | y = x//128 20 | z = format(x%128, '02X') 21 | global v 22 | if len(z) == 1: 23 | v = "0%d 0%s" %(y,z) 24 | elif len(z) == 2: 25 | v = "0%d %s" %(y,z) 26 | return v 27 | 28 | def Fader(): 29 | typ, ch = input("Enter Channel Type and No. (e.g. 'ch 3'): ").split() 30 | while typ.isdigit() == True or ch.isdigit() == False: 31 | typ, ch = input("ERROR: Enter Channel Type and No. (e.g. 'ch 3'): ").split() 32 | ch = int(ch) 33 | if typ == "ch": 34 | xtyp = format(51, '02X') 35 | while ch > 64: 36 | ch = int(input("Re-Enter Channel No. ")) 37 | chN = ch 38 | ch = format(ch-1, '02X') 39 | elif typ == "st": 40 | xtyp = format(51, '02X') 41 | while ch > 4: 42 | ch = int(input("Re-Enter Stereo Channel No. ")) 43 | chN = ch 44 | ch = format(ch*2+62, '02X') 45 | elif typ == "mix": 46 | xtyp = format(78, '02X') 47 | while ch > 16: 48 | ch = int(input("Re-Enter Mix No. ")) 49 | chN = ch 50 | ch = format(ch-1, '02X') 51 | elif typ == "mt" or typ == "mtrx": 52 | xtyp = format(95, '02X') 53 | while ch > 8: 54 | ch = int(input("Re-Enter Matrix No. ")) 55 | chN = ch 56 | ch = format(ch-1, '02X') 57 | d = input("At dB: ") 58 | while d.isalpha() == True: 59 | d = input("ERROR: At dB: ") 60 | dN = d 61 | d = float(d) 62 | if abs(d) != d: 63 | d *= -1 64 | if d <= 138.0 and d >= 96.0: 65 | q = 47 - d//3 66 | elif d <= 95.0 and d >= 78.0: 67 | q = 111 - d 68 | elif d <= 77.8 and d >= 40.0: 69 | q = 423 - d*5 70 | elif d <= 39.9 and d >= 20.0: 71 | q = 623 - d*10 72 | elif d <= 19.95 and d >= 0.05: 73 | q = 823 - d*20 74 | else: 75 | q = 823 + d*20 76 | 77 | Midi2(q) 78 | 79 | data[c] = "Fader: %s %d at %sdB" %(typ,chN,dN) 80 | msg[c] = "%s 00 %s 00 00 00 %s 00 00 00 %s" %(pre,xtyp,ch,v) 81 | print("%s 00 %s 00 00 00 %s 00 00 00 %s" %(pre,xtyp,ch,v)) 82 | 83 | def OnCue(): 84 | typ, ch = input("Enter Channel Type and No. (e.g. 'ch 5'): ").split() 85 | while typ.isdigit() == True or ch.isdigit() == False: 86 | typ, ch = input("ERROR: Enter Channel Type and No. (e.g. 'ch 5'): ").split() 87 | ch = int(ch) 88 | op = input("Enter Operation (on, off, cue, nocue): ") 89 | while op.isdigit() == True: 90 | op = input("ERROR: Enter Operation (on, off, cue, nocue): ") 91 | 92 | if op == "on" or op == "cue": 93 | q = format(1, '02X') 94 | else: 95 | q = format(0, '02X') 96 | 97 | if op == "on" or op == "off": 98 | if typ == "ch": 99 | xtyp = format(49, '02X') 100 | while ch > 64: 101 | ch = input("Re-Enter Channel No. ") 102 | chN = ch 103 | ch = format(ch-1, '02X') 104 | elif typ == "st": 105 | xtyp = format(49, '02X') 106 | while ch > 4: 107 | ch = input("Re-Enter Stereo Channel No. ") 108 | chN = ch 109 | ch = format(ch*2+62, '02X') 110 | elif typ == "mix": 111 | xtyp = format(76, '02X') 112 | while ch > 16: 113 | ch = input("Re-Enter Mix No. ") 114 | chN = ch 115 | ch = format(ch-1, '02X') 116 | elif typ == "mt" or typ == "mtrx": 117 | xtyp = format(93, '02X') 118 | while ch > 8: 119 | ch = input("Re-Enter Matrix No. ") 120 | chN = ch 121 | ch = format(ch-1, '02X') 122 | 123 | msg[c] = "%s 00 %s 00 00 00 %s 00 00 00 00 %s" %(pre,xtyp,ch,q) 124 | print("%s 00 %s 00 00 00 %s 00 00 00 00 %s" %(pre,xtyp,ch,q)) 125 | 126 | if op == "cue" or op == "nocue": 127 | if typ == "ch": 128 | xtyp = format(94, '02X') 129 | while ch > 64: 130 | ch = input("Re-Enter Channel No. ") 131 | chN = ch 132 | ch = format(ch-1, '02X') 133 | elif typ == "st": 134 | xtyp = format(94, '02X') 135 | while ch > 4: 136 | ch = input("Re-Enter Stereo Channel No. ") 137 | chN = ch 138 | ch = format(ch*2+62, '02X') 139 | elif typ == "mix": 140 | xtyp = format(95, '02X') 141 | while ch > 16: 142 | print("mix error") 143 | ch = input("Re-Enter Mix No. ") 144 | chN = ch 145 | ch = format(ch-1, '02X') 146 | elif typ == "mt" or typ == "mtrx": 147 | xtyp = format(96, '02X') 148 | while ch > 8: 149 | ch = input("Re-Enter Matrix No. ") 150 | chN = ch 151 | ch = format(ch-1, '02X') 152 | 153 | msg[c] = "%s 01 %s 00 00 00 %s 00 00 00 00 %s" %(pre,xtyp,ch,q) 154 | print("%s 01 %s 00 00 00 %s 00 00 00 00 %s" %(pre,xtyp,ch,q)) 155 | op = op.upper() 156 | data[c] = "On/Cue: %s %d: %s" %(typ,chN,op) 157 | 158 | def SendToMix(): 159 | ch = input("Input Channel No: ") 160 | while ch.isdigit() == False: 161 | ch = input("ERROR: Input Channel No: ") 162 | while int(ch) > 64: 163 | ch = input("Re-Enter Input Channel No: ") 164 | 165 | mix = input("Send to Mix: ") 166 | while mix.isdigit() == False: 167 | mix = input("ERROR: Send to Mix: ") 168 | mix = int(mix) 169 | while mix > 16: 170 | mix = input("Re-Enter Mix No. ") 171 | 172 | ch = int(ch) 173 | chN = ch 174 | mixN = mix 175 | 176 | mix = format(mix*3+2, '02X') 177 | ch = format(ch-1, '02X') 178 | 179 | d = input("At dB: ") 180 | while d.isalpha() == True: 181 | d = input("ERROR: At dB: ") 182 | 183 | dN = d 184 | d = float(d) 185 | if abs(d) != d: 186 | d *= -1 187 | if d <= 138.0 and d >= 96.0: 188 | q = 47 - d//3 189 | elif d <= 95.0 and d >= 78.0: 190 | q = 111 - d 191 | elif d <= 77.8 and d >= 40.0: 192 | q = 423 - d*5 193 | elif d <= 39.9 and d >= 20.0: 194 | q = 623 - d*10 195 | elif d <= 19.95 and d >= 0.05: 196 | q = 823 - d*20 197 | else: 198 | q = 823 + d*20 199 | 200 | Midi2(q) 201 | 202 | 203 | data[c] = "Send: Input %d to Mix %d at %s" %(chN,mixN,dN) 204 | msg[c] = "%s 00 43 00 %s 00 %s 00 00 00 %s" %(pre,mix,ch,v) 205 | print("%s 00 43 00 %s 00 %s 00 00 00 %s" %(pre,mix,ch,v)) 206 | 207 | def Custom(): 208 | 209 | cust = input("Enter Custom Fader Channel No (33-36 St. In): ") 210 | while cust.isdigit() == False: 211 | cust = input("ERROR: Enter Custom Fader Channel No (33-36 St. In): ") 212 | cust = int(cust) 213 | while cust > 68: 214 | print("error") 215 | cust = input("Re-Enter Custom Fader Channel No. ") 216 | custN = cust 217 | 218 | if cust > 32: 219 | cust = format(cust-1, '02X') 220 | ch = input("Enter Stereo Input Channel No: ") 221 | while ch > 4: 222 | print("error") 223 | ch = input("Re-Enter Stereo Input Channel No. ") 224 | chN = ch 225 | ch = format(2*ch+62, '02X') 226 | ch = "00 00 00 00 %s" %(ch) 227 | else: 228 | cust = format(cust-1, '02X') 229 | typ = input("Enter Channel Type (e.g. 'ch / mix' , 'x' for NO Assign): ") 230 | while typ.isdigit() == True: 231 | typ = input("ERROR: Enter Channel Type: ") 232 | 233 | if typ == "x": 234 | ch = "0F 7F 7F 7F 7F" 235 | chN = "No Assign" 236 | elif typ == "mono" or typ == "sub": 237 | ch = "00 00 00 00 62" 238 | chN = "" 239 | else: 240 | ch = int(input("Enter Channel/Mix/Matrix No: ")) 241 | if typ == "ch": 242 | while ch > 64: 243 | print("error") 244 | ch = input("Re-Enter Channel No. ") 245 | chN = ch 246 | ch = format(ch-1, '02X') 247 | elif typ == "mix": 248 | while ch > 16: 249 | print("error") 250 | ch = input("Re-Enter Mix No. ") 251 | chN = ch 252 | ch = format(ch+71, '02X') 253 | elif typ == "mt" or typ == "mtrx": 254 | while ch > 8: 255 | print("error") 256 | ch = input("Re-Enter Matrix No. ") 257 | chN = ch 258 | ch = format(ch+87, '02X') 259 | 260 | ch = "00 00 00 00 %s" %(ch) 261 | chN = str(chN) 262 | msg[c] = "%s 02 2C 00 %s 00 03 %s" %(pre,cust,ch) 263 | data[c] = "Cust: %s %s --> custom %s" %(typ,chN,custN) 264 | print("%s 02 2C 00 %s 00 03 %s" %(pre,cust,ch)) 265 | 266 | 267 | main = 0 268 | global c 269 | c = 0 270 | global msg 271 | msg = [""] * 99 272 | data = [""] * 99 273 | 274 | def Menu(): 275 | print("Menu:") 276 | print("1 - Fader Level") 277 | print("2 - Ch On/Cue") 278 | print("3 - Send to Mix") 279 | print("4 - Custom Fader Assign") 280 | print("5 - Help") 281 | print("6 - Exit & Print") 282 | 283 | def functReturnInput(main): 284 | print("") 285 | time.sleep(0.5) 286 | t = input("Press 'enter' to Repeat, or 'q' to return to Menu: ") 287 | try: 288 | t = str(t) 289 | if t == 'q': 290 | print("") 291 | return 0 292 | else: 293 | return main 294 | except ValueError: 295 | return main 296 | 297 | while main != 5: 298 | Menu() 299 | main = input("Type in a number (1-6): ") 300 | try: 301 | if main == "q": 302 | exit() 303 | main = int(main) 304 | except ValueError: 305 | print("ERROR") 306 | 307 | while main == 1: 308 | print("") 309 | Fader() 310 | c += 1 311 | main = functReturnInput(1) 312 | while main == 2: 313 | print("") 314 | OnCue() 315 | c += 1 316 | main = functReturnInput(2) 317 | while main == 3: 318 | print("") 319 | SendToMix() 320 | c += 1 321 | main = functReturnInput(3) 322 | while main == 4: 323 | print("") 324 | Custom() 325 | c += 1 326 | main = functReturnInput(4) 327 | if main == 5: 328 | print("") 329 | print("F0 43 10 3E 12 01 00 'typ' 00 'xx' cc cc dd dd dd dd dd F7") 330 | print("") 331 | time.sleep(3) 332 | main = 0 333 | if main == 6: 334 | print("") 335 | for a in range(0, c): 336 | print(data[a]) 337 | print(msg[a]) 338 | print("") 339 | print("") 340 | print("Thank You") 341 | exit() 342 | -------------------------------------------------------------------------------- /00 Import all to library.applescript: -------------------------------------------------------------------------------- 1 | -- @description Import all script to user library 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.1 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Run this script in MacOS's "Script Editor" to import all scripts in a folder (including within subfolders) to the user's "Library/Script Libraries" 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.1 + can install specific versions of the library from github, and notes the version if launched in Qlab. 12 | -- v2.0 + can now optionally import scripts directly from github 13 | -- v1.3 + add default location when choosing a folder 14 | -- v1.2 + creates "Script Libraries" folder if it doesn't already exist 15 | 16 | 17 | -- USER DEFINED VARIABLES ----------------- 18 | 19 | set gitVersionToGet to "latest" -- latest, or a git version tag. If using an old file, set this to the version previously installed. 20 | 21 | 22 | ---------- END OF USER DEFINED VARIABLES -- 23 | 24 | 25 | -- RUN SCRIPT ----------------------------- 26 | 27 | set theMethod to button returned of (display dialog "Would you like to install from github, or from a local folder?" with title "Install from github?" buttons {"Github", "Local", "Cancel"} default button "Github") 28 | 29 | global scriptFiles 30 | set scriptFiles to {} 31 | 32 | -- Git clone the current master branch 33 | if theMethod is "Github" then 34 | tell application "Finder" 35 | set homeLocation to path to home folder 36 | 37 | if gitVersionToGet is "latest" then 38 | set gitClone to "cd " & (POSIX path of homeLocation) & "&& git clone https://github.com/bsmith96/Qlab-Scripts.git qlab-scripts-temp" 39 | else 40 | set gitClone to "cd " & (POSIX path of homeLocation) & "&& git clone https://github.com/bsmith96/Qlab-Scripts.git qlab-scripts-temp -b " & gitVersionToGet & " --single-branch" 41 | end if 42 | 43 | do shell script gitClone 44 | 45 | set scriptFolder to (POSIX path of homeLocation) & "qlab-scripts-temp" 46 | set scriptFolder to (POSIX file scriptFolder) as alias 47 | 48 | -- Get version number for notes 49 | set getGitVersion to "cd " & (POSIX path of scriptFolder) & "&& git describe --tags" 50 | 51 | set gitVersion to do shell script getGitVersion 52 | 53 | end tell 54 | end if 55 | 56 | -- Get user input: folder to import 57 | if theMethod is "Local" then 58 | tell application "Finder" 59 | set currentPath to container of (path to me) as alias 60 | end tell 61 | 62 | set scriptFolder to choose folder with prompt "Please select the folder containing scripts to import" default location currentPath 63 | end if 64 | findAllScripts(scriptFolder) 65 | 66 | tell application "Finder" 67 | 68 | repeat with eachScript in scriptFiles 69 | set fileName to name of (info for (eachScript as alias) without size) 70 | if fileName ends with ".applescript" then 71 | set fileName to (characters 1 thru -(12 + 1) of fileName as string) 72 | end if 73 | 74 | set rootPath to POSIX path of (scriptFolder as alias) 75 | set originalPath to POSIX path of (eachScript as alias) 76 | set pathInRoot to my trimLine(originalPath, rootPath, 0) 77 | set pathInLibrary to my trimLine(pathInRoot, ".applescript", 1) 78 | 79 | try 80 | set newRoot to (POSIX path of (path to library folder from user domain) & "Script Libraries/") 81 | set testRoot to (POSIX file newRoot as alias) 82 | on error 83 | -- if folder doesn't exist 84 | set rootFolderName to "Script Libraries" 85 | set rootFolderPath to (POSIX path of (path to library folder from user domain)) 86 | set newRootFolder to make new folder at (POSIX file rootFolderPath as alias) 87 | set name of newRootFolder to rootFolderName 88 | set newRoot to (POSIX path of (path to library folder from user domain) & rootFolderName & "/") 89 | end try 90 | set newPath to newRoot & pathInRoot 91 | set newPath to my trimLine(newPath, ".applescript", 1) & ".scpt" 92 | 93 | -- compile script 94 | 95 | set newFolder to my trimLine(newPath, fileName & ".scpt", 1) 96 | log newFolder 97 | try 98 | set testFolder to (POSIX file newFolder as alias) 99 | on error 100 | -- if folder doesn't exist 101 | set theFolderName to my trimLine(newFolder, newRoot, 0) 102 | set theFolderPath to my splitString(theFolderName, "/") 103 | repeat with eachFolder from 1 to ((count of theFolderPath) - 1) 104 | try 105 | set theFolder to make new folder at (POSIX file newRoot as alias) 106 | set name of theFolder to (item eachFolder of theFolderPath) as string 107 | on error 108 | try 109 | delete theFolder 110 | end try 111 | end try 112 | set newRoot to newRoot & (item eachFolder of theFolderPath) & "/" 113 | end repeat 114 | end try 115 | 116 | set osaCommand to "osacompile -o \"" & newPath & "\" \"" & originalPath & "\"" 117 | log osaCommand 118 | log pathInLibrary 119 | 120 | try 121 | do shell script osaCommand 122 | end try 123 | end repeat 124 | 125 | end tell 126 | 127 | 128 | if theMethod is "Github" then 129 | tell application "Finder" 130 | delete folder scriptFolder 131 | end tell 132 | 133 | try 134 | tell application id "com.figure53.Qlab.4" to tell front workspace 135 | -- set q number of (last item of (selected as list)) to gitVersion 136 | set installerCue to last item of (selected as list) 137 | if q type of installerCue is "Script" then 138 | set installerName to q display name of installerCue 139 | set originalInstallerName to last item of my splitString(installerName, " | ") 140 | set q name of installerCue to gitVersion & " installed | " & originalInstallerName 141 | end if 142 | end tell 143 | end try 144 | end if 145 | 146 | display notification "Installation complete - all scripts have been compiled into the \"Script Libraries\" folder" 147 | 148 | 149 | -- FUNCTIONS ------------------------------ 150 | 151 | on findAllScripts(theFolder) 152 | tell application "Finder" 153 | set allItems to every item of theFolder 154 | 155 | repeat with eachItem in allItems 156 | if kind of (info for (eachItem as alias) without size) is "folder" then 157 | my findAllScripts(eachItem) 158 | else 159 | if name extension of (info for (eachItem as alias) without size) is "applescript" then 160 | set end of scriptFiles to eachItem 161 | end if 162 | end if 163 | 164 | end repeat 165 | 166 | end tell 167 | end findAllScripts 168 | 169 | on trimLine(theText, trimChars, trimIndicator) 170 | -- trimIndicator options: 171 | -- 0 = beginning 172 | -- 1 = end 173 | -- 2 = both 174 | 175 | set x to the length of the trimChars 176 | 177 | 178 | ---- Trim beginning 179 | 180 | if the trimIndicator is in {0, 2} then 181 | repeat while theText begins with the trimChars 182 | try 183 | set theText to characters (x + 1) thru -1 of theText as string 184 | on error 185 | -- if the text contains nothing but the trim characters 186 | return "" 187 | end try 188 | end repeat 189 | end if 190 | 191 | 192 | ---- Trim ending 193 | 194 | if the trimIndicator is in {1, 2} then 195 | repeat while theText ends with the trimChars 196 | try 197 | set theText to characters 1 thru -(x + 1) of theText as string 198 | on error 199 | -- if the text contains nothing but the trim characters 200 | return "" 201 | end try 202 | end repeat 203 | end if 204 | 205 | return theText 206 | end trimLine 207 | 208 | on splitString(theString, theDelimiter) 209 | -- save delimiters to restore old settings 210 | set oldDelimiters to AppleScript's text item delimiters 211 | -- set delimiters to delimiter to be used 212 | set AppleScript's text item delimiters to theDelimiter 213 | -- create the array 214 | set theArray to every text item of theString 215 | -- restore old setting 216 | set AppleScript's text item delimiters to oldDelimiters 217 | -- return the array 218 | return theArray 219 | end splitString -------------------------------------------------------------------------------- /00 Import scripts as links.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create cues to run external scripts in Qlab 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Run this script in MacOS's "Script Editor" to quickly create script cues using the scripts in this repository. As of Qlab 4.6.9 you cannot set "run in separate process" through applescript. Input your default, and the script will alert you if you need to change it. 8 | -- @separateprocess TRUE 9 | 10 | 11 | -- RUN SCRIPT ----------------------------- 12 | 13 | -- Declarations 14 | 15 | use framework "Foundation" 16 | use framework "OSAKit" 17 | use scripting additions 18 | 19 | -- Get user input: scripts to generate cues for 20 | 21 | set scriptFiles to choose file with prompt "Please select the scripts to import" of type {"applescript"} with multiple selections allowed 22 | 23 | -- Repeat with each selected script 24 | 25 | repeat with eachScript in scriptFiles 26 | 27 | -- Compile script 28 | 29 | set aURL to (current application's |NSURL|'s fileURLWithPath:(POSIX path of eachScript)) 30 | set destinationURL to (aURL's URLByDeletingPathExtension()'s URLByAppendingPathExtension:"scpt") 31 | 32 | -- Create a list of each line of the script 33 | 34 | set eachScriptContents to paragraphs of (read eachScript) 35 | 36 | set scriptContents to "" 37 | 38 | log "-----------" 39 | 40 | set userDefinedVariables to false 41 | 42 | 43 | repeat with eachLine in eachScriptContents 44 | 45 | -- Get tags 46 | 47 | if eachLine contains "@description" then 48 | set eachScriptDescription to trimLine(eachLine, "-- @description ", 0) 49 | log "Description: " & eachScriptDescription 50 | else if eachLine contains "@author" then 51 | set eachScriptAuthor to trimLine(eachLine, "-- @author ", 0) 52 | log "Author: " & eachScriptAuthor 53 | else if eachLine contains "@source" then 54 | set eachScriptSource to trimLine(eachLine, "-- @source ", 0) 55 | log "Source: " & eachScriptSource 56 | else if eachLine contains "@version" then 57 | set eachScriptVersion to trimLine(eachLine, "-- @version ", 0) 58 | log "Version: " & eachScriptVersion 59 | else if eachLine contains "@testedmacos" then 60 | set eachScriptMacOS to trimLine(eachLine, "-- @testedmacos ", 0) 61 | log "MacOS: " & eachScriptMacOS 62 | else if eachLine contains "@testedqlab" then 63 | set eachScriptQlab to trimLine(eachLine, "-- @testedqlab ", 0) 64 | log "Qlab: " & eachScriptQlab 65 | else if eachLine contains "@about" then 66 | set eachScriptAbout to trimLine(eachLine, "-- @about ", 0) 67 | log "About: " & eachScriptAbout 68 | else if eachLine contains "@separateprocess" then 69 | set eachScriptSeparateProcess to trimLine(eachLine, "-- @separateprocess ", 0) 70 | log "Separate Process: " & eachScriptSeparateProcess 71 | end if 72 | 73 | if eachLine contains "USER DEFINED VARIABLES ---" then 74 | set userDefinedVariables to true 75 | set userDefinedVariablesContent to "" 76 | else if eachLine contains "--- END OF USER DEFINED VARIABLES" then 77 | set userDefinedVariablesContent to userDefinedVariablesContent & " 78 | " & eachLine 79 | set userDefinedVariables to false 80 | end if 81 | 82 | if userDefinedVariables is true then 83 | set userDefinedVariablesContent to userDefinedVariablesContent & " 84 | " & eachLine 85 | set eachLine to "" 86 | end if 87 | 88 | -- Get script source 89 | 90 | if eachLine does not contain "-- @" and eachLine does not contain "-- " then 91 | set scriptContents to scriptContents & " 92 | " & eachLine 93 | end if 94 | 95 | set scriptContents to my trimLine(scriptContents, " 96 | ", 0) 97 | 98 | 99 | end repeat 100 | 101 | try 102 | if eachScriptSeparateProcess is "FALSE" then return -- scripts need to work as a separate process for this method 103 | end try 104 | 105 | set {theScript, theError} to (current application's OSAScript's alloc()'s initWithContentsOfURL:aURL |error|:(reference)) 106 | if theScript is missing value then error theError's |description|() as text 107 | set {theResult, theError} to (theScript's compileAndReturnError:(reference)) 108 | if theResult as boolean is false then return theError's |description|() as text 109 | set {theResult, theError} to (theScript's writeToURL:destinationURL ofType:"scpt" usingStorageOptions:0 |error|:(reference)) 110 | if theResult as boolean is false then return theError's |description|() as text 111 | 112 | set newPathAlias to destinationURL as alias 113 | set newPath to POSIX path of newPathAlias 114 | log newPath 115 | 116 | tell application id "com.figure53.Qlab.4" to tell front workspace 117 | 118 | -- Get cue to write, or create cue 119 | 120 | set selectedCues to (selected as list) 121 | 122 | if (length of scriptFiles is 1) and (length of selectedCues is 1) and (q type of item 1 of selectedCues is "Script") then 123 | set scriptCue to last item of (selected as list) 124 | else 125 | make type "Script" 126 | set scriptCue to last item of (selected as list) 127 | end if 128 | 129 | -- Set cue name 130 | 131 | try 132 | set q name of scriptCue to eachScriptDescription 133 | on error 134 | tell application "System Events" 135 | set cueName to name of eachScript 136 | set cueName to my trimLine(cueName, ".applescript", 1) 137 | end tell 138 | set q name of scriptCue to cueName 139 | end try 140 | 141 | -- Set cue note 142 | 143 | try 144 | set cueNote to eachScriptAbout 145 | try 146 | set cueNote to cueNote & " (" & eachScriptAuthor 147 | try 148 | set cueNote to cueNote & " // " & eachScriptSource & ")" 149 | on error 150 | set cueNote to cueNote & ")" 151 | end try 152 | end try 153 | set notes of scriptCue to cueNote 154 | end try 155 | 156 | -- Set script source 157 | 158 | set newScriptSource to "set theScript to load script \"" & (newPath) & "\" 159 | 160 | run theScript" 161 | 162 | try 163 | set script source of scriptCue to "-- @version " & eachScriptVersion & " 164 | 165 | " 166 | on error 167 | set script source of scriptCue to "" 168 | end try 169 | 170 | set script source of scriptCue to script source of scriptCue & userDefinedVariablesContent & " 171 | 172 | 173 | " & newScriptSource 174 | 175 | end tell 176 | 177 | 178 | end repeat 179 | 180 | 181 | -- FUNCTIONS ------------------------------ 182 | 183 | on trimLine(theText, trimChars, trimIndicator) 184 | -- trimIndicator options: 185 | -- 0 = beginning 186 | -- 1 = end 187 | -- 2 = both 188 | 189 | set x to the length of the trimChars 190 | 191 | 192 | ---- Trim beginning 193 | 194 | if the trimIndicator is in {0, 2} then 195 | repeat while theText begins with the trimChars 196 | try 197 | set theText to characters (x + 1) thru -1 of theText as string 198 | on error 199 | -- if the text contains nothing but the trim characters 200 | return "" 201 | end try 202 | end repeat 203 | end if 204 | 205 | 206 | ---- Trim ending 207 | 208 | if the trimIndicator is in {1, 2} then 209 | repeat while theText ends with the trimChars 210 | try 211 | set theText to characters 1 thru -(x + 1) of theText as string 212 | on error 213 | -- if the text contains nothing but the trim characters 214 | return "" 215 | end try 216 | end repeat 217 | end if 218 | 219 | return theText 220 | end trimLine -------------------------------------------------------------------------------- /00 Import scripts to cues.applescript: -------------------------------------------------------------------------------- 1 | -- @description Import scripts to cues 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.2 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.10 7 | -- @about Run this script in MacOS's "Script Editor" to quickly create script cues using the scripts in this repository. As of Qlab 4.6.9 you cannot set "run in separate process" through applescript. Input your default, and the script will alert you if you need to change it. 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.2 + updated console logging to log all available information when not all metadata tags are provided 12 | -- + non-tagged scripts now import into cues named without ".applescript" extension 13 | -- + updated trimLine function formatting (replaced snake_case with camelCase) 14 | 15 | 16 | -- USER DEFINED VARIABLES ----------------- 17 | 18 | set defaultSeparateProcess to "TRUE" -- your Qlab default for script cues as a string, either "TRUE" or "FALSE" 19 | 20 | set versionWarnings to true -- set to false if you do not with to be notified about version differences between your system and the system the scripts have been tested on 21 | 22 | ---------- END OF USER DEFINED VARIABLES -- 23 | 24 | 25 | -- RUN SCRIPT ----------------------------- 26 | 27 | -- Get user input: scripts to generate cues for 28 | 29 | set scriptFiles to choose file with prompt "Please select the scripts to import" of type {"public.text"} with multiple selections allowed 30 | 31 | -- Repeat with each selected script 32 | 33 | repeat with eachScript in scriptFiles 34 | 35 | -- Create a list of each line of the script 36 | 37 | set eachScriptContents to paragraphs of (read eachScript) 38 | 39 | set scriptContents to "" 40 | 41 | log "-----------" 42 | 43 | repeat with eachLine in eachScriptContents 44 | 45 | -- Get tags 46 | 47 | if eachLine contains "@description" then 48 | set eachScriptDescription to trimLine(eachLine, "-- @description ", 0) 49 | log "Description: " & eachScriptDescription 50 | else if eachLine contains "@author" then 51 | set eachScriptAuthor to trimLine(eachLine, "-- @author ", 0) 52 | log "Author: " & eachScriptAuthor 53 | else if eachLine contains "@source" then 54 | set eachScriptSource to trimLine(eachLine, "-- @source ", 0) 55 | log "Source: " & eachScriptSource 56 | else if eachLine contains "@version" then 57 | set eachScriptVersion to trimLine(eachLine, "-- @version ", 0) 58 | log "Version: " & eachScriptVersion 59 | else if eachLine contains "@testedmacos" then 60 | set eachScriptMacOS to trimLine(eachLine, "-- @testedmacos ", 0) 61 | log "MacOS: " & eachScriptMacOS 62 | else if eachLine contains "@testedqlab" then 63 | set eachScriptQlab to trimLine(eachLine, "-- @testedqlab ", 0) 64 | log "Qlab: " & eachScriptQlab 65 | else if eachLine contains "@about" then 66 | set eachScriptAbout to trimLine(eachLine, "-- @about ", 0) 67 | log "About: " & eachScriptAbout 68 | else if eachLine contains "@separateprocess" then 69 | set eachScriptSeparateProcess to trimLine(eachLine, "-- @separateprocess ", 0) 70 | log "Separate Process: " & eachScriptSeparateProcess 71 | end if 72 | 73 | -- Get script source 74 | 75 | if eachLine does not contain "-- @" and eachLine does not contain "-- " then 76 | set scriptContents to scriptContents & " 77 | " & eachLine 78 | end if 79 | 80 | set scriptContents to my trimLine(scriptContents, " 81 | ", 0) 82 | 83 | end repeat 84 | 85 | tell application id "com.figure53.Qlab.4" to tell front workspace 86 | 87 | -- Get cue to write, or create cue 88 | 89 | set selectedCues to (selected as list) 90 | 91 | if (length of scriptFiles is 1) and (length of selectedCues is 1) and (q type of item 1 of selectedCues is "Script") then 92 | set scriptCue to last item of (selected as list) 93 | else 94 | make type "Script" 95 | set scriptCue to last item of (selected as list) 96 | end if 97 | 98 | -- Set cue name 99 | 100 | try 101 | set q name of scriptCue to eachScriptDescription 102 | on error 103 | tell application "System Events" 104 | set cueName to name of eachScript 105 | set cueName to my trimLine(cueName, ".applescript", 1) 106 | end tell 107 | set q name of scriptCue to cueName 108 | end try 109 | 110 | -- Set cue note 111 | 112 | try 113 | set cueNote to eachScriptAbout 114 | try 115 | set cueNote to cueNote & " (" & eachScriptAuthor 116 | try 117 | set cueNote to cueNote & " // " & eachScriptSource & ")" 118 | on error 119 | set cueNote to cueNote & ")" 120 | end try 121 | end try 122 | set notes of scriptCue to cueNote 123 | end try 124 | 125 | -- Set script source 126 | 127 | try 128 | set script source of scriptCue to "-- @version " & eachScriptVersion & " 129 | 130 | " & scriptContents 131 | on error 132 | set script source of scriptCue to scriptContents 133 | end try 134 | 135 | -- Alert user if "run in separate process" should be off 136 | 137 | try 138 | if eachScriptSeparateProcess is not defaultSeparateProcess then 139 | display dialog "The script \"" & eachScriptDescription & "\" requires you to change the state of \"Run in separate process\" in the script tab of the inspector" 140 | end if 141 | end try 142 | 143 | -- Get current version of Qlab 144 | 145 | set currentQlabVersion to version of application id "com.figure53.Qlab.4" 146 | log "Current Qlab Version: " & currentQlabVersion 147 | 148 | -- Get current version of MacOS 149 | 150 | set currentMacOSVersion to system version of (system info) 151 | log "Current MacOS Version: " & currentMacOSVersion 152 | 153 | -- Warn user of version differences 154 | 155 | if versionWarnings is true then 156 | 157 | try 158 | 159 | if currentMacOSVersion is not eachScriptMacOS then 160 | set versionIssueMacOS to true 161 | else 162 | set versionIssueMacOS to false 163 | end if 164 | 165 | if currentQlabVersion is not eachScriptQlab then 166 | set versionIssueQlab to true 167 | else 168 | set versionIssueQlab to false 169 | end if 170 | 171 | 172 | if versionIssueMacOS is true and versionIssueQlab is false then 173 | -- Issue with MacOS version 174 | display notification "Be aware that this script has not been tested with your version of MacOS" with title eachScriptDescription 175 | log "The script \"" & eachScriptDescription & "\" has not been tested with your current version of MacOS. TESTED: " & eachScriptMacOS & ", CURRENT: " & currentMacOSVersion 176 | else if versionIssueMacOS is false and versionIssueQlab is true then 177 | -- Issue with Qlab version 178 | display notification "Be aware that this script has not been tested with your version of Qlab" with title eachScriptDescription 179 | log "The script \"" & eachScriptDescription & "\" has not been tested with your current version of Qlab. TESTED: " & eachScriptQlab & ", CURRENT: " & currentQlabVersion 180 | else if versionIssueMacOS is true and versionIssueQlab is true then 181 | -- Issue with MacOS and Qlab versions 182 | display notification "Be aware this this script has not been tested with your version of MacOS or your version of Qlab" with title eachScriptDescription 183 | log "The script \"" & eachScriptDescription & "\" has not been tested with your current version or MacOS or your current version of Qlab. MACOS TESTED: " & eachScriptMacOS & ", CURRENT: " & currentMacOSVersion & ". QLAB TESTED: " & eachScriptQlab & ", CURRENT: " & currentQlabVersion 184 | end if 185 | end try 186 | 187 | end if 188 | 189 | end tell 190 | 191 | end repeat 192 | 193 | 194 | -- FUNCTIONS ------------------------------ 195 | 196 | on trimLine(theText, trimChars, trimIndicator) 197 | -- trimIndicator options: 198 | -- 0 = beginning 199 | -- 1 = end 200 | -- 2 = both 201 | 202 | set x to the length of the trimChars 203 | 204 | 205 | ---- Trim beginning 206 | 207 | if the trimIndicator is in {0, 2} then 208 | repeat while theText begins with the trimChars 209 | try 210 | set theText to characters (x + 1) thru -1 of theText as string 211 | on error 212 | -- if the text contains nothing but the trim characters 213 | return "" 214 | end try 215 | end repeat 216 | end if 217 | 218 | 219 | ---- Trim ending 220 | 221 | if the trimIndicator is in {1, 2} then 222 | repeat while theText ends with the trimChars 223 | try 224 | set theText to characters 1 thru -(x + 1) of theText as string 225 | on error 226 | -- if the text contains nothing but the trim characters 227 | return "" 228 | end try 229 | end repeat 230 | end if 231 | 232 | return theText 233 | end trimLine -------------------------------------------------------------------------------- /00 List of available colours for cues.md: -------------------------------------------------------------------------------- 1 | # List of available colors for cues 2 | 3 | 4 | - grey 5 | - red 6 | - orange 7 | - green 8 | - blue 9 | - purple 10 | - edgecombGray 11 | - mauve 12 | - chartreuse 13 | - bastardAmber 14 | - lilac 15 | - maize 16 | - glaucous 17 | - fuchsia 18 | - ecru 19 | - coral 20 | - cerulean 21 | - celadon 22 | - bizque 23 | - avocado 24 | - ochre 25 | - olive 26 | - puce 27 | - rufous 28 | - sage 29 | - scarlet 30 | - seaFoamGreen 31 | - skyBlue 32 | - taupe 33 | - verdigris 34 | - vermillion 35 | - viridian 36 | - fulvous 37 | - wenge 38 | - zaffre 39 | - indigo -------------------------------------------------------------------------------- /00 Retrieve metadata headers.applescript: -------------------------------------------------------------------------------- 1 | -- @description Import scripts to cues 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.2 5 | -- @about Module to retrieve metadata headers 6 | 7 | property util : script "Applescript Utilities" 8 | 9 | global headerOptions, lineUndefined 10 | set headerOptions to {¬ 11 | "Description", ¬ 12 | "Author", ¬ 13 | "Link", ¬ 14 | "Version", ¬ 15 | "Changelog", ¬ 16 | "About", ¬ 17 | "Tested MacOS", ¬ 18 | "Tested Qlab", ¬ 19 | "Separate Process"} 20 | 21 | on retrieveHeaders(theScript) 22 | set theScriptContents to paragraphs of (read theScript) 23 | 24 | set indentLevel to 0 25 | 26 | set scriptContents to "" 27 | 28 | log "--------" 29 | 30 | repeat with eachLine in theScriptContents 31 | 32 | -- get tags 33 | 34 | repeat with eachOption in headerOptions 35 | set eachOptionNoSpace to util's splitString(eachOption, " ") 36 | if eachOption is in eachLine then 37 | try 38 | log eachOption & ": " & item 2 of util's splitString(eachLine, eachOption & " ") 39 | on error 40 | multilineHeader(theScript, eachOption) 41 | end try 42 | else if (eachOptionNoSpace as string) is in eachLine then 43 | try 44 | log eachOption & ": " & item 2 of util's splitString(eachLine, (eachOptionNoSpace as string) & " ") 45 | on error 46 | multilineHeader(theScript, eachOptionNoSpace) 47 | end try 48 | end if 49 | end repeat 50 | end repeat 51 | end retrieveHeaders 52 | 53 | on multilineHeader(theScript, theHeader) 54 | set theScriptContents to paragraphs of (read theScript) 55 | 56 | set inTheHeader to false 57 | set theHeaderContents to "" 58 | global testVar 59 | 60 | repeat with eachLine in theScriptContents 61 | if eachLine is "" then 62 | set inTheHeader to false 63 | log "2 " & eachLine 64 | else if theHeader is in eachLine then 65 | set inTheHeader to true 66 | log "1 " & eachLine 67 | else if inTheHeader is true then 68 | set theHeaderContents to theHeaderContents & util's trimLine(eachLine, "-- ", 0) & " 69 | " 70 | log "3 " & eachLine 71 | set testVar to eachLine 72 | end if 73 | (*repeat with eachOption in headerOptions 74 | if theHeader is in eachLine then 75 | set inTheHeader to true 76 | else if eachOption is in eachLine then 77 | set inTheHeader to false 78 | else if (util's splitString(eachOption, " ") as string) is in eachLine then 79 | set inTheHeader to false 80 | else if eachLine is "" then 81 | set inTheHeader to false 82 | else if inTheHeader is true then 83 | set theHeaderContents to theHeaderContents & " 84 | " & util's trimLine(eachLine, "-- ", 0) 85 | end if 86 | end repeat*) 87 | end repeat 88 | 89 | global aGlobalVar 90 | set aGlobalVar to theHeaderContents 91 | end multilineHeader 92 | 93 | -- BUG HERE currently doesn't stop at blank lines, can't stop it. 94 | 95 | on findHeaders(theScript) 96 | 97 | end findHeaders 98 | 99 | log headerOptions 100 | 101 | set scriptFile to choose file 102 | 103 | retrieveHeaders(scriptFile) 104 | -------------------------------------------------------------------------------- /Applescript Utilities.applescript: -------------------------------------------------------------------------------- 1 | -- @description Applescript Utilities 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.0 5 | -- @about Common functions to call for other scripts 6 | 7 | -- @changelog 8 | -- v1.0 + init 9 | 10 | 11 | -- USER DEFINED VARIABLES ----------------- 12 | 13 | ---------- END OF USER DEFINED VARIABLES -- 14 | 15 | 16 | -- VARIABLES FROM QLAB NOTES -------------- 17 | 18 | ------------------ END OF QLAB VARIABLES -- 19 | 20 | 21 | ---- RUN SCRIPT --------------------------- 22 | 23 | 24 | -- FUNCTIONS ------------------------------ 25 | 26 | on splitString(theString, theDelimiter) 27 | -- save delimiters to restore old settings 28 | set oldDelimiters to AppleScript's text item delimiters 29 | -- set delimiters to delimiter to be used 30 | set AppleScript's text item delimiters to theDelimiter 31 | -- create the array 32 | set theArray to every text item of theString 33 | -- restore old setting 34 | set AppleScript's text item delimiters to oldDelimiters 35 | -- return the array 36 | return theArray 37 | end splitString 38 | 39 | on findAndReplaceInText(theText, theSearchString, theReplacementString) 40 | set AppleScript's text item delimiters to theSearchString 41 | set theTextItems to every text item of theText 42 | set AppleScript's text item delimiters to theReplacementString 43 | set theText to theTextItems as string 44 | set AppleScript's text item delimiters to "" 45 | return theText 46 | end findAndReplaceInText 47 | 48 | on trimLine(theText, trimChars, trimIndicator) 49 | -- trimIndicator options: 50 | -- 0 = beginning 51 | -- 1 = end 52 | -- 2 = both 53 | 54 | set x to the length of the trimChars 55 | 56 | 57 | ---- Trim beginning 58 | 59 | if the trimIndicator is in {0, 2} then 60 | repeat while theText begins with the trimChars 61 | try 62 | set theText to characters (x + 1) thru -1 of theText as string 63 | on error 64 | -- if the text contains nothing but the trim characters 65 | return "" 66 | end try 67 | end repeat 68 | end if 69 | 70 | 71 | ---- Trim ending 72 | 73 | if the trimIndicator is in {1, 2} then 74 | repeat while theText ends with the trimChars 75 | try 76 | set theText to characters 1 thru -(x + 1) of theText as string 77 | on error 78 | -- if the text contains nothing but the trim characters 79 | return "" 80 | end try 81 | end repeat 82 | end if 83 | 84 | return theText 85 | end trimLine 86 | 87 | on insertItemInList(theItem, theList, thePosition) 88 | set theListCount to length of theList 89 | if thePosition is 0 then 90 | return false 91 | else if thePosition is less than 0 then 92 | if (thePosition * -1) is greater than theListCount + 1 then return false 93 | else 94 | if thePosition is greater than theListCount + 1 then return false 95 | end if 96 | if thePosition is less than 0 then 97 | if (thePosition * -1) is theListCount + 1 then 98 | set beginning of theList to theItem 99 | else 100 | set theList to reverse of theList 101 | set thePosition to (thePosition * -1) 102 | if thePosition is 1 then 103 | set beginning of theList to theItem 104 | else if thePosition is (theListCount + 1) then 105 | set end of theList to theItem 106 | else 107 | set theList to (items 1 thru (thePosition - 1) of theList) & theItem & (items thePosition thru -1 of theList) 108 | end if 109 | set theList to reverse of theList 110 | end if 111 | else 112 | if thePosition is 1 then 113 | set beginning of theList to theItem 114 | else if thePosition is (theListCount + 1) then 115 | set end of theList to theItem 116 | else 117 | set theList to (items 1 thru (thePosition - 1) of theList) & theItem & (items thePosition thru -1 of theList) 118 | end if 119 | end if 120 | return theList 121 | end insertItemInList 122 | 123 | on sortList(theList) 124 | set the indexList to {} 125 | set the sortedList to {} 126 | set theListNames to {} 127 | set sortedListNames to {} 128 | 129 | -- Create a list with the names of the files 130 | repeat with i from 1 to (count of theList) 131 | set eachItem to item i of theList 132 | tell application "Finder" 133 | set end of theListNames to (name of eachItem as string) 134 | end tell 135 | end repeat 136 | 137 | -- Sort the list of filenames alphabetically (by output number) 138 | repeat (the number of items in theListNames) times 139 | set the lowItem to "" 140 | repeat with i from 1 to (number of items in theListNames) 141 | if i is not in the indexList then 142 | set thisItem to item i of theListNames 143 | if the lowItem is "" then 144 | set the lowItem to thisItem 145 | set the lowItemIndex to i 146 | else if thisItem comes before the lowItem then 147 | set the lowItem to thisItem 148 | set the lowItemIndex to i 149 | end if 150 | end if 151 | end repeat 152 | set the end of sortedListNames to the lowItem 153 | set the end of the indexList to the lowItemIndex 154 | end repeat 155 | 156 | -- Use the index list to create a sorted list of the files themselves 157 | repeat with eachItem in indexList 158 | set end of sortedList to item eachItem of theList 159 | end repeat 160 | 161 | return the sortedList 162 | end sortList 163 | 164 | on listPosition(theItem, theList) 165 | repeat with i from 1 to the count of theList 166 | if item i of theList is theItem then return i 167 | end repeat 168 | return 0 169 | end listPosition 170 | 171 | on getFileName(theFile) 172 | tell application "Finder" 173 | set fileName to name of theFile 174 | end tell 175 | end getFileName -------------------------------------------------------------------------------- /Control/Convert Eos OSC cues to MSC.applescript: -------------------------------------------------------------------------------- 1 | -- @description Convert EOS OSC cues to MSC 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.0 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Replace programmed Eos OSC cues with MSC cues instead. Replaces any selected cues which are EOS triggers. 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.0 + init 12 | 13 | 14 | -- USER DEFINED VARIABLES ----------------- 15 | 16 | set lxDeviceID to 1 -- Device ID of lighting console 17 | set commandFormat to 1 -- Lighting (general) 18 | set commandNumber to 1 -- GO 19 | 20 | 21 | ---------- END OF USER DEFINED VARIABLES -- 22 | 23 | 24 | -- VARIABLES FROM QLAB NOTES -------------- 25 | 26 | ------------------ END OF QLAB VARIABLES -- 27 | 28 | property util : script "Applescript Utilities" 29 | 30 | 31 | ---- RUN SCRIPT --------------------------- 32 | 33 | tell application id "com.figure53.Qlab.4" to tell front workspace 34 | 35 | set selectedCues to (selected as list) 36 | set selectedOSC to {} 37 | 38 | repeat with eachCue in selectedCues 39 | if q type of eachCue is "Network" then 40 | set end of selectedOSC to eachCue 41 | end if 42 | end repeat 43 | 44 | repeat with eachCue in selectedOSC 45 | set selected to eachCue -- select OSC cue 46 | 47 | set oscCommand to custom message of eachCue -- get OSC command 48 | set oscList to util's splitString(oscCommand, "/") -- get list version 49 | 50 | if item 2 of oscList is "eos" and item -1 of oscList is "fire" then 51 | make type "MIDI" -- make midi cue 52 | set newCue to last item of (selected as list) -- give midi cue a variable 53 | 54 | set message type of newCue to msc -- make midi cue an MSC cue 55 | 56 | if (count of oscList) is 6 then -- > IF THE OSC CUE INCLUDES A CUE LIST 57 | set cueList to item 4 of oscList -- get cue list no. 58 | set cueNumber to item 5 of oscList -- get cue number 59 | else if (count of oscList) is 5 then -- > IF THE OSC CUE DOESN'T INCLUDE A CUE LIST 60 | set cueNumber to item 4 of oscList -- get cue number 61 | set cueList to "" -- leave cue list no. blank 62 | else -- > IF THE OSC CUE IS NOT CORRECTLY FORMATTED FOR THIS SCRIPT 63 | set q name of newCue to "ERROR - OSC message incorrect" 64 | set q color of newCue to "red" 65 | error number -128 66 | end if 67 | 68 | set command format of newCue to commandFormat -- set type to Lighting General 69 | set command number of newCue to commandNumber -- set go 70 | set deviceID of newCue to lxDeviceID -- set MSC device ID 71 | set q_number of newCue to cueNumber -- set cue number 72 | set q_list of newCue to cueList -- set cue list 73 | 74 | -- name cue to look the same 75 | set q name of newCue to "MSC: " & (q display name of eachCue) 76 | 77 | -- delete original cue 78 | delete cue id (uniqueID of eachCue) of parent of eachCue 79 | end if 80 | 81 | 82 | end repeat 83 | 84 | end tell 85 | -------------------------------------------------------------------------------- /Control/Create A&H Midi Cue.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create A&H Midi control cue 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.1 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Create a GLD / SQ Midi control cue in a separate cue list 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.1 + ability to control whether you are asked for a name 12 | -- + Numbers midi cue to make it easier to find 13 | -- v1.0 + init 14 | 15 | 16 | -- USER DEFINED VARIABLES ----------------- 17 | 18 | try -- if global variables are given when this script is called by another, use those variables 19 | cueTitle 20 | on error 21 | set cueTitle to "SQ5" 22 | end try 23 | 24 | try 25 | cuePatch 26 | on error 27 | set cuePatch to "1" 28 | end try 29 | 30 | try 31 | askForValue 32 | on error 33 | set askForValue to "Cue Number" 34 | end try 35 | 36 | try 37 | askForName 38 | on error 39 | set askForName to true 40 | end try 41 | 42 | try 43 | cueColor 44 | on error 45 | set cueColor to "green" 46 | end try 47 | 48 | ---------- END OF USER DEFINED VARIABLES -- 49 | 50 | 51 | ---- RUN SCRIPT --------------------------- 52 | 53 | tell application id "com.figure53.Qlab.4" to tell front workspace 54 | 55 | -- save current position 56 | try 57 | set currentPosition to last item of (selected as list) 58 | end try 59 | set currentCueList to current cue list 60 | 61 | -- Get context 62 | display dialog "Please provide " & askForValue with title cueTitle default answer "" 63 | set sceneNumber to (text returned of result) as integer 64 | 65 | if askForName then 66 | display dialog "Please provide cue name" with title "cueTitle" default answer "" 67 | set sceneName to (text returned of result) 68 | end if 69 | 70 | -- Construct midi message 71 | set bankNumHex to my calculateBank(sceneNumber) 72 | set sceneNumHex to my calculateScene(sceneNumber) 73 | 74 | set bankMessage to "B0 00 " & bankNumHex 75 | set sceneMessage to " C0 " & sceneNumHex 76 | 77 | -- Create cue list if necessary, or switch to it 78 | try 79 | set cueList to first cue list whose q name is (cueTitle & " control") 80 | on error 81 | make type "cue list" 82 | set cueList to first cue list whose q name is "Cue list" 83 | set q name of cueList to (cueTitle & " control") 84 | set q color of cueList to cueColor 85 | collapse cueList 86 | end try 87 | 88 | set current cue list to cueList 89 | 90 | -- Create cue 91 | make type "Midi" 92 | set midiCue to last item of (selected as list) 93 | set message type of midiCue to sysex 94 | set patch of midiCue to cuePatch 95 | 96 | -- Set cue 97 | set sysex message of midiCue to bankMessage & sceneMessage 98 | if askForName then 99 | set q name of midiCue to cueTitle & ": Scene " & sceneNumber & " - " & sceneName 100 | else 101 | set q name of midiCue to cueTitle & ": Scene " & sceneNumber 102 | end if 103 | try 104 | set q number of midiCue to "Q" & my (q number of getTopLevel(currentPosition)) & "\\Sc" & sceneNumber 105 | end try 106 | 107 | -- put start cue in original cue list 108 | set current cue list to currentCueList 109 | try 110 | set selected to currentPosition 111 | end try 112 | 113 | make type "Start" 114 | set startCue to last item of (selected as list) 115 | set cue target of startCue to midiCue 116 | if askForName then 117 | set q name of startCue to cueTitle & ": Scene " & sceneNumber & " - " & sceneName 118 | else 119 | set q name of startCue to cueTitle & ": Scene " & sceneNumber 120 | end if 121 | set q color of startCue to cueColor 122 | if q type of (parent of startCue) is not "cue list" then 123 | set q color of (parent of startCue) to cueColor 124 | end if 125 | 126 | end tell 127 | 128 | 129 | -- FUNCTIONS ------------------------------ 130 | 131 | on calculateBank(num) 132 | set bank to integer 133 | if num is less than 129 then 134 | set bank to "00" 135 | end if 136 | if num is greater than 128 and num is less than 257 then 137 | set bank to "01" 138 | end if 139 | if num is greater than 256 and num is less than 385 then 140 | set bank to "02" 141 | end if 142 | if num is greater than 384 and num is less than 501 then 143 | set bank to "03" 144 | end if 145 | 146 | 147 | set bankNumHex to bank 148 | end calculateBank 149 | 150 | on calculateScene(num) 151 | set scene to integer 152 | if num is less than 129 then 153 | set scene to num - 1 154 | end if 155 | if num is greater than 128 and num is less than 257 then 156 | set scene to (num - 129) 157 | end if 158 | if num is greater than 256 and num is less than 385 then 159 | set scene to (num - 257) 160 | end if 161 | if num is greater than 384 and num is less than 501 then 162 | set scene to (num - 385) 163 | end if 164 | 165 | set sceneHex to do shell script "perl -e 'printf(\"%02X\", " & scene & ")'" 166 | 167 | set sceneNumHex to sceneHex 168 | end calculateScene 169 | 170 | on getTopLevel(theCue) 171 | tell application id "com.figure53.Qlab.4" to tell front workspace 172 | if q type of (parent of theCue) is "cue list" then 173 | return theCue 174 | else 175 | my getTopLevel(parent of theCue) 176 | end if 177 | end tell 178 | end getTopLevel 179 | -------------------------------------------------------------------------------- /Control/Create OSC control cue.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create OSC control cue 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.2 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Create an OSC control cue 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.2 + no longer creates orphaned broken cues if you cancel in the dialog box 12 | 13 | 14 | -- USER DEFINED VARIABLES ----------------- 15 | 16 | try 17 | cueTitle 18 | on error 19 | set cueTitle to "LX" 20 | end try 21 | 22 | try 23 | cuePatch 24 | on error 25 | set cuePatch to "2" 26 | end try 27 | 28 | try -- if global variables are given when this script is called by another, use those variables 29 | stringBase 30 | on error 31 | set stringBase to "/eos/cue" 32 | end try 33 | 34 | try 35 | stringSuffix 36 | on error 37 | set stringSuffix to "/fire" 38 | end try 39 | 40 | try 41 | askForInString 42 | on error 43 | set askForInString to {"Cue List Number", "Cue Number"} 44 | end try 45 | 46 | try 47 | askForValue 48 | on error 49 | set askForValue to "" 50 | end try 51 | 52 | try 53 | cueColor 54 | on error 55 | set cueColor to "Blue" 56 | end try 57 | 58 | ---------- END OF USER DEFINED VARIABLES -- 59 | 60 | 61 | ---- RUN SCRIPT --------------------------- 62 | 63 | tell application id "com.figure53.Qlab.4" to tell front workspace 64 | 65 | -- save current position 66 | try 67 | set currentPosition to last item of (selected as list) 68 | end try 69 | set currentCueList to current cue list 70 | 71 | -- Get context 72 | if askForInString is not {} then 73 | set userString to {} 74 | repeat with eachItem in askForInString 75 | display dialog "Please provide " & eachItem with title cueTitle default answer "" 76 | set end of userString to ("/" & (text returned of result)) 77 | end repeat 78 | end if 79 | 80 | if askForValue is not "" then 81 | display dialog "Please provide " & askForValue with title cueTitle default answer "" 82 | set userValue to (text returned of result) 83 | end if 84 | 85 | -- Construct command 86 | try 87 | set oscCommand to stringBase & (every item of userString as string) & stringSuffix 88 | on error 89 | set oscCommand to stringBase & stringSuffix 90 | end try 91 | if askForValue is not "" then 92 | set oscCommand to oscCommand & " " & userValue 93 | end if 94 | 95 | -- Create cue list if necessary, or switch to it 96 | try 97 | set cueList to first cue list whose q name is (cueTitle & " control") 98 | on error 99 | make type "cue list" 100 | set cueList to first cue list whose q name is "Cue list" 101 | set q name of cueList to (cueTitle & " control") 102 | set q color of cueList to cueColor 103 | collapse cueList 104 | end try 105 | 106 | set current cue list to cueList 107 | 108 | -- Create cue 109 | make type "Network" 110 | set networkCue to last item of (selected as list) 111 | set osc message type of networkCue to custom 112 | set patch of networkCue to cuePatch 113 | 114 | -- Set cue 115 | set custom message of networkCue to oscCommand 116 | set q name of networkCue to cueTitle & ": " & oscCommand 117 | set q color of networkCue to cueColor 118 | 119 | -- put start cue in original cue list 120 | set current cue list to currentCueList 121 | try 122 | set selected to currentPosition 123 | end try 124 | 125 | make type "Start" 126 | set startCue to last item of (selected as list) 127 | set cue target of startCue to networkCue 128 | set q name of startCue to cueTitle & ": " & oscCommand 129 | set q color of startCue to cueColor 130 | if q type of (parent of startCue) is not "cue list" then 131 | set q color of (parent of startCue) to cueColor 132 | end if 133 | 134 | end tell 135 | -------------------------------------------------------------------------------- /Control/Set midi trigger of selected cue.applescript: -------------------------------------------------------------------------------- 1 | -- @description Set midi trigger of selected cue 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.0 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Sets the midi trigger of the currently selected cue to a program change 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.0 + init 12 | 13 | 14 | ---- RUN SCRIPT --------------------------- 15 | 16 | -- ask for the value 17 | set theResult to display dialog "What program change value would you like to use to trigger this cue?" default answer "" 18 | 19 | -- catch errors in user submission 20 | try 21 | set midiValue to text returned of theResult as integer 22 | on error 23 | display dialog "That value was not an integer. Please try again." 24 | error -128 25 | end try 26 | 27 | tell application id "com.figure53.Qlab.4" to tell front workspace 28 | 29 | -- get selected cue 30 | set selectedCue to last item of (selected as list) 31 | 32 | -- set midi trigger for selected cue 33 | tell selectedCue 34 | set midi trigger to enabled 35 | set midi command to program_change 36 | set midi byte one to midiValue 37 | end tell 38 | 39 | end tell -------------------------------------------------------------------------------- /Cue Lists/Add new section heading.applescript: -------------------------------------------------------------------------------- 1 | -- @description Add new section heading 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.0 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Adds a memo marker, and a "go-to" cue in the group above to skip it in the cue stack 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.0 + init 12 | 13 | 14 | -- USER DEFINED VARIABLES ----------------- 15 | 16 | try -- if global variables are given when this script is called by another, use those variables 17 | userColor 18 | on error 19 | set userColor to "coral" 20 | end try 21 | 22 | ---------- END OF USER DEFINED VARIABLES -- 23 | 24 | 25 | -- VARIABLES FROM QLAB NOTES -------------- 26 | 27 | ------------------ END OF QLAB VARIABLES -- 28 | 29 | 30 | property util : script "Applescript Utilities" 31 | 32 | 33 | ---- RUN SCRIPT --------------------------- 34 | 35 | tell application id "com.figure53.Qlab.4" to tell front workspace 36 | try 37 | -- save current selection 38 | set currentCue to last item of (selected as list) 39 | 40 | -- check if the current selection is top level, or within a group 41 | set currentTopLevel to my getTopLevel(currentCue) 42 | set lastCueBeforeMarker to my getTopLevel(cue before currentTopLevel) 43 | end try 44 | 45 | -- ask for section name 46 | set sectionName to text returned of (display dialog "What title would you like to use for this section?" with title "Section Name" default answer "") 47 | 48 | -- make memo cue 49 | try 50 | set selected to lastCueBeforeMarker 51 | end try 52 | make type "memo" 53 | set newCue to last item of (selected as list) 54 | set q color of newCue to userColor 55 | set q name of newCue to (do shell script "echo " & sectionName & " | tr [:lower:] [:upper:]") 56 | 57 | 58 | 59 | try 60 | -- make goTo cue, to skip the section heading 61 | set selected to lastCueBeforeMarker 62 | make type "goTo" 63 | set goToCue to last item of (selected as list) 64 | move cue id (uniqueID of goToCue) of parent of goToCue to end of lastCueBeforeMarker 65 | set cue target of goToCue to currentTopLevel 66 | 67 | -- return to original selection 68 | set selected to currentCue 69 | end try 70 | 71 | 72 | end tell 73 | 74 | 75 | -- FUNCTIONS ------------------------------ 76 | 77 | on getTopLevel(theCue) 78 | tell application id "com.figure53.Qlab.4" to tell front workspace 79 | if q type of (parent of theCue) is "cue list" then 80 | return theCue 81 | else 82 | my getTopLevel(parent of theCue) 83 | end if 84 | end tell 85 | end getTopLevel 86 | -------------------------------------------------------------------------------- /Cue Lists/Create locate cue in Main Cue List.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create a locate cue in Main Cue List 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.1 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Create a cue in the Main Cue List to locate another cue list to a specific point 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.1 + allows assignment of UDVs from the script calling this one 12 | 13 | 14 | -- USER DEFINED VARIABLES ----------------- 15 | 16 | try -- if global variables are given when this script is called by another, use those variables 17 | userCueList 18 | on error 19 | set userCueList to "Main Cue List" 20 | end try 21 | 22 | ---------- END OF USER DEFINED VARIABLES -- 23 | 24 | 25 | -- RUN SCRIPT ----------------------------- 26 | 27 | tell application id "com.figure53.Qlab.4" to tell front workspace 28 | set originalCueList to q name of current cue list 29 | if originalCueList is not userCueList then 30 | set selectedCues to selected as list 31 | set current cue list to first cue list whose q name is userCueList 32 | repeat with eachCue in selectedCues 33 | make type "GoTo" 34 | set newCue to last item of (selected as list) 35 | set cue target of newCue to eachCue 36 | set nameString to "Locate | " 37 | set eachNumber to q number of eachCue 38 | set eachName to q display name of eachCue 39 | set nameString to nameString & eachName 40 | if originalCueList is not "" then 41 | set nameString to nameString & " | " & originalCueList 42 | end if 43 | set q name of newCue to nameString 44 | end repeat 45 | delay 0.5 46 | set current cue list to first cue list whose q name is originalCueList 47 | set playback position of current cue list to last item of selectedCues 48 | end if 49 | end tell -------------------------------------------------------------------------------- /Cue Lists/Create start cue in Main Cue List.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create start cue in Main Cue List 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 1.2 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Creates a cue at the end of Main Cue List targeting the currently selected cue in another cue list. 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.2 + allows assignment of UDVs from the script calling this one 13 | -- v1.1 + runs in external process 14 | -- v1.0 + init 15 | 16 | 17 | -- USER DEFINED VARIABLES ----------------- 18 | 19 | try -- if global variables are given when this script is called by another, use those variables 20 | userCueList 21 | on error 22 | set userCueList to "Main Cue List" 23 | end try 24 | 25 | ---------- END OF USER DEFINED VARIABLES -- 26 | 27 | 28 | -- RUN SCRIPT ----------------------------- 29 | 30 | tell application id "com.figure53.Qlab.4" to tell front workspace 31 | set originalCueList to q name of current cue list 32 | if originalCueList is not userCueList then 33 | set selectedCues to selected as list 34 | set current cue list to first cue list whose q name is userCueList 35 | repeat with eachCue in selectedCues 36 | make type "Start" 37 | set newCue to last item of (selected as list) 38 | set cue target of newCue to eachCue 39 | set nameString to "Start | " 40 | set eachNumber to q number of eachCue 41 | set eachName to q display name of eachCue 42 | set nameString to nameString & eachName 43 | if originalCueList is not "" then 44 | set nameString to nameString & " | " & originalCueList 45 | end if 46 | set q name of newCue to nameString 47 | if eachNumber is not "" then 48 | set q number of newCue to ("s" & eachNumber) 49 | end if 50 | 51 | 52 | end repeat 53 | delay 0.5 -- Let you see it 54 | set current cue list to first cue list whose q name is originalCueList 55 | set playback position of current cue list to last item of selectedCues 56 | (* This will maintain the selection (more or less) if "Playback position is always the selected cue" is ON *) 57 | end if 58 | end tell -------------------------------------------------------------------------------- /Cue Tools/ArmDisarm through dialog.applescript: -------------------------------------------------------------------------------- 1 | -- @description Arm/Disarm through dialog 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 1.1 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Set the arm state of cues based on a string in their name 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.1 + runs as separate process 13 | 14 | 15 | -- USER DEFINED VARIABLES ----------------- 16 | 17 | set userDefaultSearchString to "" 18 | 19 | ---------- END OF USER DEFINED VARIABLES -- 20 | 21 | 22 | -- RUN SCRIPT ----------------------------- 23 | 24 | -- Define variables 25 | 26 | global dialogTitle 27 | set dialogTitle to "Batch Arm/Disarm" 28 | 29 | -- Get the search string 30 | 31 | set {theText, theButton} to {text returned, button returned} of (display dialog "Arm/disarm cues whose name contains (return an empty string to cancel):" with title dialogTitle with icon 1 default answer userDefaultSearchString buttons {"Toggle", "Arm", "Disarm"} default button "Disarm") 32 | 33 | -- Check for cancel 34 | 35 | if theText is "" then 36 | error number -128 37 | end if 38 | 39 | -- Copy the search string to the Clipboard and arm/disarm the cues 40 | 41 | set the clipboard to theText 42 | 43 | tell application id "com.figure53.Qlab.4" to tell front workspace 44 | set foundCues to every cue whose q name contains theText 45 | --set foundCuesRef to a reference to foundCues 46 | repeat with eachCue in reverse of foundCues 47 | if theButton is "Arm" then 48 | set armed of eachCue to true 49 | else if theButton is "Disarm" then 50 | set armed of eachCue to false 51 | else 52 | set armed of eachCue to not armed of eachCue 53 | end if 54 | end repeat 55 | end tell -------------------------------------------------------------------------------- /Cue Tools/Put selected cue(s) in a new group cue.applescript: -------------------------------------------------------------------------------- 1 | -- @description Put selected cues in a new group cue 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 1.1 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Adds a group cue above the selection and moves the selected cues into it 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.1 + runs as separate process 13 | 14 | 15 | tell application id "com.figure53.Qlab.4" to tell front workspace 16 | 17 | try -- This will stop the script if we're in a cart, as it doesn't make sense to continue! 18 | set inACart to mode of current cue list -- ###FIXME### As of 4.6.10, this throws an error for carts; if this is fixed this section won't work 19 | on error 20 | return 21 | end try 22 | 23 | set selectedCues to (selected as list) 24 | if (count selectedCues) is not 0 then 25 | 26 | set selected to last item of selectedCues 27 | make type "Group" 28 | set groupCue to last item of (selected as list) 29 | set groupCueIsIn to parent of groupCue 30 | 31 | repeat with eachCue in selectedCues 32 | if contents of eachCue is not groupCueIsIn then -- Skip a Group Cue that contains the new Group Cue 33 | set eachCueID to uniqueID of eachCue 34 | try 35 | move cue id eachCueID of parent of eachCue to end of groupCue 36 | end try 37 | end if 38 | end repeat 39 | 40 | end if 41 | 42 | end tell -------------------------------------------------------------------------------- /Cue Tools/Put selected cue(s) in a new group with notes & number.applescript: -------------------------------------------------------------------------------- 1 | -- @description Put selected cues in a new group cue with notes and number 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 1.1 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Adds a group cue above the current selection with the name, notes and number of the first selected cue, and puts the selected cues into the group 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.1 + runs as separate process 13 | 14 | 15 | tell application id "com.figure53.Qlab.4" to tell front workspace 16 | 17 | try -- This will stop the script if we're in a cart, as it doesn't make sense to continue! 18 | set inACart to mode of current cue list -- ###FIXME### As of 4.6.10, this throws an error for carts; if this is fixed this section won't work 19 | on error 20 | return 21 | end try 22 | 23 | set selectedCues to selected as list 24 | if (count selectedCues) is not 0 then 25 | 26 | set selected to last item of selectedCues 27 | make type "Group" 28 | set groupCue to last item of (selected as list) 29 | set groupCueIsIn to parent of groupCue 30 | 31 | set cueNumber to q number of first item of selectedCues 32 | set q number of first item of selectedCues to "" 33 | set q number of groupCue to cueNumber 34 | repeat with i from 1 to (count selectedCues) 35 | set eachName to q name of item i of selectedCues 36 | if i = 1 then 37 | set cueName to eachName 38 | else 39 | if eachName ≠ "" then 40 | set cueName to cueName & " & " & eachName 41 | end if 42 | end if 43 | end repeat 44 | set q name of groupCue to cueName 45 | set cueNotes to notes of first item of selectedCues 46 | if cueNotes is not missing value then 47 | set notes of first item of selectedCues to "" 48 | set notes of groupCue to cueNotes 49 | end if 50 | 51 | repeat with eachCue in selectedCues 52 | if contents of eachCue is not groupCueIsIn then -- Skip a Group Cue that contains the new Group Cue 53 | set eachCueID to uniqueID of eachCue 54 | move cue id eachCueID of parent of eachCue to end of groupCue 55 | end if 56 | end repeat 57 | 58 | end if 59 | end tell -------------------------------------------------------------------------------- /Cue Tools/Set autoload off.applescript: -------------------------------------------------------------------------------- 1 | -- @description Set autoload off 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.1 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Turns off autoload for the selected cue [obselete due to OSC] 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.1 + runs as separate process 12 | 13 | 14 | tell application id "com.figure53.Qlab.4" to tell front workspace 15 | 16 | repeat with eachCue in (selected as list) 17 | set autoload of eachCue to false 18 | end repeat 19 | 20 | end tell -------------------------------------------------------------------------------- /Cue Tools/Set autoload on.applescript: -------------------------------------------------------------------------------- 1 | -- @description Set autoload on 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.1 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Turns on autoload for the selected cue [obselete due to OSC] 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.1 + runs as separate process 12 | 13 | 14 | tell application id "com.figure53.Qlab.4" to tell front workspace 15 | 16 | repeat with eachCue in (selected as list) 17 | set autoload of eachCue to true 18 | end repeat 19 | 20 | end tell -------------------------------------------------------------------------------- /Cue Tools/Set target to the cue above.applescript: -------------------------------------------------------------------------------- 1 | -- @description Set target to the cue above 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 1.1 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Sets the cue target from the current cue (e.g. fades, stops) to the cue above 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.1 + runs as separate process 13 | 14 | 15 | -- Define variables 16 | 17 | set simpleCases to {"Start", "Stop", "Pause", "Reset", "Load", "Goto", "Arm", "Disarm"} 18 | set specialCases to {"Fade", "Animation", "Devamp", "Target"} 19 | set acceptableTargets to {"Audio", "Video", "Audio", "Goto"} 20 | 21 | -- Run script 22 | 23 | tell application id "com.figure53.Qlab.4" to tell front workspace 24 | set originalCue to last item of (selected as list) 25 | set originalType to q type of originalCue 26 | 27 | if originalType is in simpleCases then 28 | moveSelectionUp 29 | set targetCue to last item of (selected as list) 30 | try 31 | set cue target of originalCue to targetCue 32 | set targetName to q name of targetCue 33 | set q name of originalCue to originalType & ": " & targetName 34 | end try 35 | moveSelectionDown 36 | 37 | else if originalType is in specialCases then 38 | 39 | repeat with i from 1 to count specialCases 40 | if originalType is item i of specialCases then 41 | set acceptableType to item i of acceptableTargets 42 | exit repeat 43 | end if 44 | end repeat 45 | 46 | set foundType to "" 47 | set moveCounter to 0 48 | repeat while foundType is not acceptableType 49 | 50 | moveSelectionUp 51 | set moveCounter to moveCounter + 1 52 | set targetCue to last item of (selected as list) 53 | set foundType to q type of targetCue 54 | if targetCue is first item of cues of current cue list then 55 | exit repeat 56 | end if 57 | end repeat 58 | 59 | if foundType is acceptableType then 60 | set cue target of originalCue to targetCue 61 | set targetName to q name of targetCue 62 | set q name of originalCue to originalType & ": " & targetName 63 | end if 64 | 65 | repeat moveCounter times 66 | moveSelectionDown 67 | end repeat 68 | 69 | end if 70 | 71 | end tell -------------------------------------------------------------------------------- /Cue Tools/Toggle ARMING.applescript: -------------------------------------------------------------------------------- 1 | -- @description Toggle arming 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 1.1 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Toggles the arm state of selected cues 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.1 + runs as separate process 13 | 14 | 15 | tell application id "com.figure53.Qlab.4" to tell front workspace 16 | set selectedCues to (selected as list) 17 | if (count selectedCues) is 0 then -- If no cues are selected arm/disarm the current cue list 18 | set armed of current cue list to not armed of current cue list 19 | else 20 | repeat with eachCue in reverse of selectedCues -- Reversed so as to do a Group Cue's children before it 21 | set armed of eachCue to not armed of eachCue 22 | end repeat 23 | end if 24 | end tell -------------------------------------------------------------------------------- /Cue Tools/Turn off infinite loop.applescript: -------------------------------------------------------------------------------- 1 | -- @description Turn off infinite loop 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 1.1 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Turns off infinite loop for the selected cue [obselete due to OSC] 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.1 + runs as separate process 13 | 14 | 15 | tell application id "com.figure53.Qlab.4" to tell front workspace 16 | repeat with eachCue in (selected as list) 17 | try 18 | set infinite loop of eachCue to false 19 | end try 20 | end repeat 21 | end tell -------------------------------------------------------------------------------- /Cue Tools/Turn on infinite loop.applescript: -------------------------------------------------------------------------------- 1 | -- @description Turn on infinite loop 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 1.1 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Turns on infinite loop for the selected cue [obselete due to OSC] 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.1 + runs as separate process 13 | 14 | 15 | tell application id "com.figure53.Qlab.4" to tell front workspace 16 | repeat with eachCue in (selected as list) 17 | try 18 | set infinite loop of eachCue to true 19 | end try 20 | end repeat 21 | end tell -------------------------------------------------------------------------------- /Fades/Create fade in.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create fade in 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 3.0 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Create a fade in for the selected audio/group cue 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v3.0 + moved common functions to external script 13 | -- v2.0 + subroutines 14 | -- + doesn't daisychain "Fade xxx: " in group names 15 | 16 | 17 | property util : script "Applescript Utilities" 18 | 19 | 20 | ---- RUN SCRIPT --------------------------- 21 | 22 | tell application id "com.figure53.Qlab.4" to tell front workspace 23 | set originalCue to last item of (selected as list) 24 | 25 | -- Create fade in for an audio cue 26 | 27 | if q type of originalCue is "Audio" then 28 | my createFadein(originalCue) 29 | 30 | -- Create fade in for each audio cue in a selected group 31 | 32 | else if q type of originalCue is "Group" then 33 | my createGroup(originalCue) 34 | end if 35 | end tell 36 | 37 | 38 | -- FUNCTIONS ------------------------------ 39 | 40 | on createFadein(theCue) 41 | tell application id "com.figure53.Qlab.4" to tell front workspace 42 | set theCueLevel to theCue getLevel row 0 column 0 43 | theCue setLevel row 0 column 0 db -120 44 | set thePreWait to pre wait of theCue 45 | make type "Fade" 46 | set newCue to last item of (selected as list) 47 | set cue target of newCue to theCue 48 | set pre wait of newCue to thePreWait 49 | newCue setLevel row 0 column 0 db theCueLevel 50 | set q name of newCue to "Fade in: " & q display name of theCue 51 | end tell 52 | end createFadein 53 | 54 | on createGroup(theCue) 55 | tell application id "com.figure53.Qlab.4" to tell front workspace 56 | set theCueName to q name of theCue 57 | set cuesToFade to (cues in theCue) 58 | make type "Group" 59 | set fadeGroup to last item of (selected as list) 60 | set fadeGroupID to uniqueID of fadeGroup 61 | -- Remove previous "fade" in cue name, if present 62 | if theCueName starts with "Fade in: " or theCueName starts with "Fade up: " or theCueName starts with "Fade down: " then 63 | set theCueNameList to util's splitString(theCueName, ": ") 64 | set theCueName to items 2 thru -1 of theCueNameList 65 | end if 66 | set q name of fadeGroup to "Fade in: " & theCueName 67 | repeat with eachCue in cuesToFade 68 | if q type of eachCue is "Audio" then 69 | my createFadein(eachCue) 70 | set newCue to last item of (selected as list) 71 | set newCueID to uniqueID of newCue 72 | move cue id newCueID of parent of newCue to end of fadeGroup 73 | end if 74 | end repeat 75 | end tell 76 | end createGroup 77 | -------------------------------------------------------------------------------- /Fades/Create fade out.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create fade out 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 3.0 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Create a fade out for the selected audio/video/group cue 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v3.0 + moved common functions to external script 13 | -- v2.0 + subroutines 14 | -- + doesn't daisychain "Fade xxx: " in group names 15 | 16 | 17 | property util : script "Applescript Utilities" 18 | 19 | 20 | ---- RUN SCRIPT --------------------------- 21 | 22 | tell application id "com.figure53.Qlab.4" to tell front workspace 23 | set originalCue to last item of (selected as list) 24 | set originalCueType to q type of originalCue 25 | 26 | -- Create fade out for audio or video cues 27 | 28 | if originalCueType is in {"Audio", "Video"} then 29 | my createFadeOut(originalCue) 30 | 31 | -- Create fade out for audio or video cues, from a fade cue which targets the original cue 32 | 33 | else if originalCueType is "Fade" then 34 | set originalCueTarget to cue target of originalCue 35 | my createFadeOut(originalCueTarget) 36 | 37 | -- Create a fade out for every audio or video cue in a group 38 | 39 | else if originalCueType is "Group" then 40 | my createGroup(originalCue) 41 | end if 42 | end tell 43 | 44 | 45 | -- FUNCTIONS ------------------------------ 46 | 47 | on createFadeOut(theCue) 48 | tell application id "com.figure53.Qlab.4" to tell front workspace 49 | make type "Fade" 50 | set newCue to last item of (selected as list) 51 | set cue target of newCue to theCue 52 | set audio fade mode of newCue to relative 53 | newCue setLevel row 0 column 0 db -120 54 | if (q type of theCue) is not "Video" then 55 | set stop target when done of newCue to true 56 | end if 57 | set q name of newCue to "Fade out: " & q display name of theCue 58 | end tell 59 | end createFadeOut 60 | 61 | on createGroup(theCue) 62 | tell application id "com.figure53.Qlab.4" to tell front workspace 63 | set theCueName to q name of theCue 64 | set cuesToFade to (cues in theCue) 65 | make type "Group" 66 | set fadeGroup to last item of (selected as list) 67 | set fadeGroupID to uniqueID of fadeGroup 68 | -- Remove previous "fade" in cue name, if present 69 | if theCueName starts with "Fade in: " or theCueName starts with "Fade up: " or theCueName starts with "Fade down: " then 70 | set theCueNameList to util's splitString(theCueName, ": ") 71 | set theCueName to items 2 thru -1 of theCueNameList 72 | end if 73 | set q name of fadeGroup to "Fade out: " & theCueName 74 | repeat with eachCue in cuesToFade 75 | if q type of eachCue is in {"Audio", "Video"} then 76 | my createFadeOut(eachCue) 77 | set newCue to last item of (selected as list) 78 | set newCueID to uniqueID of newCue 79 | move cue id newCueID of parent of newCue to end of fadeGroup 80 | else if q type of eachCue is in {"Fade"} then 81 | try 82 | if q display name of eachCue does not start with "Fade in: " then 83 | set eachCueTarget to cue target of eachCue 84 | my createFadeOut(eachCueTarget) 85 | set newCue to last item of (selected as list) 86 | set newCueID to uniqueID of newCue 87 | move cue id newCueID of parent of newCue to end of fadeGroup 88 | end if 89 | end try 90 | end if 91 | end repeat 92 | end tell 93 | end createGroup -------------------------------------------------------------------------------- /Fades/Create fade.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create fade 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 3.1 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Create a fade down cue for the selected audio/video/fade/group cue 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v3.1 + corrected function name 13 | -- v3.0 + moved common functions to external script 14 | -- v2.1 + allows assignment of UDVs from the script calling this one 15 | -- v2.0 + subroutines 16 | -- + doesn't daisychain "Fade xxx: " in group names 17 | 18 | 19 | -- USER DEFINED VARIABLES ----------------- 20 | 21 | try -- if global variables are given when this script is called by another, use those variables 22 | userLevel 23 | on error 24 | set userLevel to -3 25 | end try 26 | 27 | try 28 | userPrefix 29 | on error 30 | set userPrefix to "Fade down: " 31 | end try 32 | 33 | ---------- END OF USER DEFINED VARIABLES -- 34 | 35 | 36 | property util : script "Applescript Utilities" 37 | 38 | 39 | -- RUN SCRIPT ----------------------------- 40 | 41 | tell application id "com.figure53.Qlab.4" to tell front workspace 42 | set originalCue to last item of (selected as list) 43 | set originalCueType to q type of originalCue 44 | 45 | -- Make a fade for each an audio or video file 46 | 47 | if originalCueType is in {"Audio", "Video"} then 48 | my createFade(originalCue, userLevel, userPrefix) 49 | 50 | -- Make a fade for an audio or video cue, from a fade cue which targets the original cue 51 | 52 | else if originalCueType is "Fade" then 53 | set originalCueTarget to cue target of originalCue 54 | if q type of originalCueTarget is not "Group" then 55 | my createFade(originalCueTarget, userLevel, userPrefix) 56 | end if 57 | 58 | -- Make a fade for each audio file in a selected group 59 | 60 | else if originalCueType is "Group" then 61 | my createGroup(originalCue, userLevel, userPrefix) 62 | end if 63 | end tell 64 | 65 | 66 | -- FUNCTIONS ------------------------------ 67 | 68 | on createFade(theCue, userLevel, userPrefix) 69 | tell application id "com.figure53.Qlab.4" to tell front workspace 70 | make type "Fade" 71 | set newCue to last item of (selected as list) 72 | set cue target of newCue to theCue 73 | set audio fade mode of newCue to relative 74 | newCue setLevel row 0 column 0 db userLevel 75 | set q name of newCue to userPrefix & q display name of theCue 76 | end tell 77 | end createFade 78 | 79 | on createGroup(theCue, userLevel, userPrefix) 80 | tell application id "com.figure53.Qlab.4" to tell front workspace 81 | set theCueName to q name of theCue 82 | set cuesToFade to (cues in theCue) 83 | make type "Group" 84 | set fadeGroup to last item of (selected as list) 85 | set fadeGroupID to uniqueID of fadeGroup 86 | -- Remove previous "fade" in cue name, if present 87 | if theCueName starts with "Fade in: " or theCueName starts with "Fade up: " or theCueName starts with "Fade down: " then 88 | set theCueNameList to util's splitString(theCueName, ": ") 89 | set theCueName to items 2 thru -1 of theCueNameList 90 | end if 91 | set q name of fadeGroup to userPrefix & theCueName 92 | repeat with eachCue in cuesToFade 93 | if q type of eachCue is in {"Audio", "Video"} then 94 | my createFade(eachCue, userLevel, userPrefix) 95 | set newCue to last item of (selected as list) 96 | set newCueID to uniqueID of newCue 97 | move cue id newCueID of parent of newCue to end of fadeGroup 98 | else if q type of eachCue is in {"Fade"} then 99 | try 100 | if q display name of eachCue does not start with "Fade in: " then 101 | set eachCueTarget to cue target of eachCue 102 | my createFade(eachCueTarget, userLevel, userPrefix) 103 | set newCue to last item of (selected as list) 104 | set newCueID to uniqueID of newCue 105 | move cue id newCueID of parent of newCue to end of fadeGroup 106 | end if 107 | end try 108 | end if 109 | end repeat 110 | end tell 111 | end createGroup -------------------------------------------------------------------------------- /Files/Label files in use.applescript: -------------------------------------------------------------------------------- 1 | -- @description Label files in use 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 1.1 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Labels files referenced by the current qlab file in finder, in a colour of the user's choice 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.1 + runs as separate process 13 | 14 | 15 | -- USER DEFINED VARIABLES ----------------- 16 | 17 | property defaultColor : "Red" 18 | 19 | ---------- END OF USER DEFINED VARIABLES -- 20 | 21 | 22 | -- RUN SCRIPT ----------------------------- 23 | 24 | set theColors to {"No color", "Orange", "Red", "Yellow", "Blue", "Purple", "Green", "Gray"} 25 | 26 | set userColor to choose from list theColors with title "Which color?" with prompt "Label files with this color:" default items {defaultColor} 27 | repeat with n from 1 to (count theColors) 28 | if ((item n of theColors) as string) is equal to (userColor as string) then 29 | set labelColor to n - 1 30 | end if 31 | end repeat 32 | 33 | tell application id "com.figure53.Qlab.4" to tell front workspace 34 | set mySel to cues 35 | repeat with myCue in mySel 36 | if q type of myCue is "Audio" or q type of myCue is "Video" then 37 | set theFile to file target of myCue 38 | tell application "Finder" 39 | set the label index of item theFile to labelColor 40 | end tell 41 | end if 42 | end repeat 43 | end tell -------------------------------------------------------------------------------- /Files/Reveal target audio file in finder.applescript: -------------------------------------------------------------------------------- 1 | -- @description Reveal target audio file in finder 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Rich Walsh (adapted) 5 | -- @version 1.1 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Reveals the target audio file of the selected cue in finder 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v1.1 + runs as separate process 13 | 14 | tell application id "com.figure53.Qlab.4" to tell front workspace 15 | 16 | set editCue to last item of (selected as list) 17 | 18 | if q type of editCue is "Audio" then 19 | set fileTarget to file target of editCue 20 | tell application "Finder" 21 | delay 1 22 | reveal fileTarget 23 | activate 24 | end tell 25 | end if 26 | 27 | end tell -------------------------------------------------------------------------------- /Files/Save New Version.applescript: -------------------------------------------------------------------------------- 1 | -- @description Save new version 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 3.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Saves a new version of your qlab file, incrementing a 2 digit version number, and allowing notes (such as a date, or "start of tech") 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v3.0 + moved common functions to external script 12 | -- v2.0 + introduced a version of semantic versioning, allowing sub-version numbers for updates 13 | -- + now works if ".qlab4" is visible in the file name in finder 14 | 15 | 16 | property util : script "Applescript Utilities" 17 | 18 | 19 | -- RUN SCRIPT ----------------------------- 20 | 21 | -- NAMING SCHEME: Name v0.0 - note. 22 | -- Ensure your existing project follows this scheme and it will create the new file correctly. 23 | 24 | -- Get original filename & path 25 | tell application id "com.figure53.Qlab.4" to tell front workspace 26 | set originalFileName to q number 27 | set originalPath to path 28 | end tell 29 | 30 | tell application "Finder" 31 | set originalPathAlias to POSIX file originalPath as alias 32 | set originalPath to (container of originalPathAlias) as alias 33 | end tell 34 | 35 | -- Remove note, if present 36 | 37 | if originalFileName contains "-" then 38 | set theResult to util's splitString(originalFileName, " - ") 39 | set originalNote to item -1 of theResult 40 | set originalNameAndVersion to item 1 of theResult 41 | else 42 | set originalNameAndVersion to originalFileName 43 | end if 44 | 45 | -- Remove version number 46 | 47 | set theResult to util's splitString(originalNameAndVersion, " v") 48 | set projectName to item 1 of theResult 49 | set originalVersion to item -1 of theResult 50 | set theResult to util's splitString(originalVersion, ".") 51 | set originalMajor to item 1 of theResult 52 | set originalMinor to item 2 of theResult 53 | 54 | -- Update version number 55 | 56 | set nextMajor to "v" & (originalMajor + 1) & ".0" 57 | set nextMinor to "v" & originalMajor & "." & (originalMinor + 1) 58 | set nextTest to "v" & originalMajor & ".t" & (originalMinor + 1) 59 | 60 | -- Ask for new version type 61 | 62 | tell application id "com.figure53.Qlab.4" to tell front workspace 63 | 64 | set nextVersionChoices to {"Minor (" & nextMinor & ")", "Major (" & nextMajor & ")"} 65 | set nextVersion to choose from list nextVersionChoices with prompt "How do you want to increment the version number?" default items {"Minor (" & nextMinor & ")"} with title (projectName & " v" & originalVersion) 66 | 67 | if nextVersion is {"Minor (" & nextMinor & ")"} then 68 | set versionNumber to nextMinor 69 | else if nextVersion is {"Major (" & nextMajor & ")"} then 70 | set versionNumber to nextMajor 71 | else if nextVersion is {"Test (" & nextTest & ")"} then 72 | set versionNumber to nextTest 73 | end if 74 | 75 | -- Ask for note 76 | 77 | set newNote to text returned of (display dialog "Would you like to set a note for this version?" with title "Version Note" default answer "") 78 | 79 | end tell 80 | 81 | -- Generate filename 82 | 83 | set newFileName to projectName & " " & versionNumber 84 | 85 | if newNote is not "" then 86 | set newFileName to newFileName & " - " & newNote 87 | end if 88 | 89 | -- Save a new version 90 | 91 | tell application id "com.figure53.Qlab.4" 92 | tell front workspace 93 | save in ((originalPath as string) & (newFileName as string)) 94 | end tell 95 | open ((originalPath as string) & (newFileName as string) & ".qlab4") 96 | close back workspace without saving 97 | end tell -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Ben Smith 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Levels/Bump level.applescript: -------------------------------------------------------------------------------- 1 | -- @description Bump cue level 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.4 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Leaves the cue master, and bumps the individual channels (which are not -inf) +6dB 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.4 + avoids duplicating bumps to ganged channels more efficiently 12 | -- v1.3 + no longer errors when no gang was assigned 13 | -- v1.2 + removes gangs temporarily, to avoid duplicate bumps 14 | -- v1.1 + allows assignment of UDVs from the script calling this one 15 | 16 | 17 | -- USER DEFINED VARIABLES ----------------- 18 | 19 | try -- if global variables are given when this script is called by another, use those variables 20 | variableCueListName 21 | on error 22 | set variableCueListName to "Other scripts & utilities" 23 | end try 24 | 25 | try 26 | bumpLevel 27 | on error 28 | set bumpLevel to 6 29 | end try 30 | 31 | ---------- END OF USER DEFINED VARIABLES -- 32 | 33 | 34 | -- VARIABLES FROM QLAB NOTES -------------- 35 | 36 | tell application id "com.figure53.Qlab.4" to tell front workspace 37 | set audioChannelCount to notes of (first cue of (first cue list whose q name is variableCueListName) whose q name is "Output channel count") as integer -- total number of Qlab output 38 | set minAudioLevel to notes of (first cue of (first cue list whose q name is variableCueListName) whose q name is "Min audio level") as integer -- audio level which is -inf 39 | end tell 40 | 41 | ------------------ END OF QLAB VARIABLES -- 42 | 43 | 44 | ---- RUN SCRIPT --------------------------- 45 | 46 | tell application id "com.figure53.Qlab.4" to tell front workspace 47 | 48 | set selectedCues to (selected as list) 49 | 50 | set cueTypes to {"Audio", "Fade", "Video", "Mic"} 51 | 52 | repeat with eachCue in selectedCues 53 | if (q type of eachCue) is in cueTypes then 54 | set allGangs to {} 55 | repeat with eachChannel from 1 to audioChannelCount as integer 56 | set oldLevel to getLevel eachCue row 0 column eachChannel 57 | set newLevel to (oldLevel + bumpLevel) 58 | if oldLevel is not minAudioLevel then 59 | set eachGang to getGang eachCue row 0 column eachChannel 60 | if eachGang is missing value then -- change unganged values 61 | setLevel eachCue row 0 column eachChannel db newLevel 62 | else if eachGang is not missing value and eachGang is not in allGangs then -- only change ganged values if they haven't already been changed 63 | setLevel eachCue row 0 column eachChannel db newLevel 64 | set end of allGangs to eachGang 65 | end if 66 | end if 67 | end repeat 68 | end if 69 | end repeat 70 | 71 | end tell 72 | -------------------------------------------------------------------------------- /Levels/Set crosspoints to current default.applescript: -------------------------------------------------------------------------------- 1 | -- @description Set crosspoints to current default 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about If you need to change the default crosspoints after programming a lot of audio cues, select all audio cues and run this script to set the crosspoints to the new default. 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.0 + moved common functions to external script 12 | 13 | 14 | -- USER DEFINED VARIABLES ----------------- 15 | 16 | set inputChannelCount to 2 17 | set outputChannelCount to 6 18 | 19 | ---------- END OF USER DEFINED VARIABLES -- 20 | 21 | 22 | property util : script "Applescript Utilities" 23 | 24 | 25 | ---- RUN SCRIPT --------------------------- 26 | 27 | tell application id "com.figure53.Qlab.4" to tell front workspace 28 | 29 | -- Define variables 30 | 31 | set useCueList to (selected as list) 32 | set defaultLevels to {} 33 | 34 | 35 | end tell 36 | 37 | -- Run script 38 | 39 | findDefault(inputChannelCount, outputChannelCount, defaultLevels) 40 | setDefault(inputChannelCount, outputChannelCount, useCueList, defaultLevels) 41 | 42 | 43 | -- FUNCTIONS ------------------------------ 44 | 45 | on findDefault(inputCount, outputCount, Levels) 46 | tell application id "com.figure53.Qlab.4" to tell front workspace 47 | 48 | make type "Audio" 49 | set defaultAudio to last item of (selected as list) 50 | set q name of defaultAudio to "REFERENCE CUE - DELETE AFTER RUNNING SCRIPT" 51 | set q color of defaultAudio to "rufous" 52 | 53 | repeat with eachRow from 1 to inputCount as integer 54 | repeat with eachCol from 0 to outputCount as integer 55 | set thisLevel to getLevel defaultAudio row eachRow column eachCol 56 | set rowAdjust to (eachRow - 1) * (outputCount + 1) 57 | if eachRow is 1 then 58 | set listPosition to eachCol + 1 59 | else if eachRow is greater than or equal to 2 then 60 | set listPosition to eachCol + rowAdjust + 1 61 | end if 62 | util's insertItemInList(thisLevel, Levels, listPosition) 63 | end repeat 64 | end repeat 65 | set defaultAudioID to uniqueID of defaultAudio 66 | delete cue id defaultAudioID of parent of defaultAudio 67 | end tell 68 | end findDefault 69 | 70 | 71 | on setDefault(inputCount, outputCount, cueList, defaultLevels) 72 | tell application id "com.figure53.Qlab.4" to tell front workspace 73 | 74 | repeat with eachCue in cueList 75 | if q type of eachCue is "Audio" then 76 | repeat with eachRow from 1 to inputCount as integer 77 | repeat with eachCol from 0 to outputCount as integer 78 | set rowAdjust to (eachRow - 1) * (outputCount + 1) 79 | if eachRow is 1 then 80 | set listPosition to eachCol + 1 81 | else if eachRow is greater than or equal to 2 then 82 | set listPosition to eachCol + rowAdjust + 1 83 | end if 84 | set newValue to (item listPosition of defaultLevels) as integer 85 | setLevel eachCue row eachRow column eachCol db newValue 86 | end repeat 87 | end repeat 88 | end if 89 | end repeat 90 | 91 | end tell 92 | end setDefault -------------------------------------------------------------------------------- /Mixing Desk Programming/Choose Desk to program.applescript: -------------------------------------------------------------------------------- 1 | -- @description Choose desk to program 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.1 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Changes which script cues the OSC "make midi desk recall" cues fire, changing the mixing desk the cues create recalls for. Current options are Allen & Heath mixing desks (GLD, SQ) and Yamaha mixing desks (CL/QL). 8 | -- @separateprocess TRUE 9 | 10 | 11 | -- @changelog 12 | -- v1.1 + added Yamaha Rivage PM series 13 | -- v1.0 + init 14 | 15 | 16 | -- RUN SCRIPT ----------------------------- 17 | 18 | tell application id "com.figure53.Qlab.4" to tell front workspace 19 | set deskOptions to {"Allen & Heath GLD/SQ", "Yamaha CL/QL", "Yamaha Rivage PM"} 20 | 21 | set deskToProgram to choose from list deskOptions with title "Choose mixing desk to program" 22 | 23 | end tell 24 | 25 | setDesk(deskToProgram) 26 | 27 | 28 | -- FUNCTIONS ------------------------------ 29 | 30 | on setDesk(desk) 31 | tell application id "com.figure53.Qlab.4" to tell front workspace 32 | if desk is {"Allen & Heath GLD/SQ"} then 33 | set q_num of cue "Recall" to "ahRecall" 34 | set q_num of cue "Name" to "ahRecallName" 35 | set armed of cue "o/s" to false 36 | else if desk is {"Yamaha CL/QL"} then 37 | set q_num of cue "Recall" to "yRecall" 38 | set q_num of cue "Name" to "yRecallName" 39 | set armed of cue "o/s" to true 40 | else if desk is {"Yamaha Rivage PM"} then 41 | set q_num of cue "Recall" to "pmRecall" 42 | set q_num of cue "Name" to "pmRecallName" 43 | set armed of cue "o/s" to false -- offsetting doesn't work because the event list must be manually updated 44 | end if 45 | 46 | end tell 47 | end setDesk -------------------------------------------------------------------------------- /Mixing Desk Programming/Create CLQL scene recall with name.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create CL/QL scene recall with name 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.1 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Creates a midi cue to recall a scene on Yamaha CL/QL mixing desks. Allows you to name the scene 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.1 + can now colour parent groups 12 | -- v1.0 + init 13 | 14 | 15 | -- USER DEFINED VARIABLES ----------------- 16 | 17 | set userColor to "green" -- the colour of groups containing midi recalls 18 | 19 | set colorParentGroups to TRUE -- set colour of any groups containing the recall group as well? 20 | 21 | set cueListName to "Main Cue List" -- Name of main cue list 22 | 23 | ---------- END OF USER DEFINED VARIABLES -- 24 | 25 | 26 | -- RUN SCRIPT ----------------------------- 27 | 28 | tell application id "com.figure53.Qlab.4" to tell front workspace 29 | -- set scene number to recall 30 | display dialog "Please select a scene number to recall" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER" 31 | set sceneNumber to text returned of result as integer 32 | display dialog "What would you like to name this scene" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NAME" 33 | set sceneName to text returned of result 34 | 35 | -- Calculate variables to use in the midi cue 36 | set chanNum to my calculateChan(sceneNumber) 37 | set sceneNum to my calculateScene(sceneNumber) 38 | 39 | set sceneGroupName to "Scene " & sceneNumber & ": " & sceneName 40 | 41 | -- Make overall group 42 | make type "Group" 43 | set sceneGroup to last item of (selected as list) 44 | set sceneGroupID to uniqueID of sceneGroup 45 | set mode of sceneGroup to timeline 46 | set q name of sceneGroup to sceneGroupName 47 | 48 | -- Make the midi program cue 49 | make type "Midi" 50 | set midiBank to last item of (selected as list) 51 | set midiBankID to uniqueID of midiBank 52 | set message type of midiBank to voice 53 | set command of midiBank to program_change 54 | set channel of midiBank to chanNum 55 | set byte one of midiBank to sceneNum 56 | move cue id midiBankID of parent of midiBank to end of sceneGroup 57 | set q name of midiBank to "Scene " & sceneNumber & ": Program Change" 58 | 59 | -- Color the group and any groups containing the group 60 | set q color of sceneGroup to userColor 61 | 62 | if colorParentGroups is TRUE 63 | set groupParent to parent of sceneGroup 64 | repeat 65 | if q name of groupParent is cueListName then 66 | exit repeat 67 | else 68 | set q color of groupParent to userColor 69 | set groupParent to parent of groupParent 70 | end if 71 | end repeat 72 | end if 73 | 74 | collapse sceneGroup 75 | 76 | end tell 77 | 78 | 79 | -- FUNCTIONS ------------------------------ 80 | 81 | -- Function to calculate the midi channel (used as a bank) 82 | on calculateChan(num) 83 | set chan to integer 84 | if num is less than 129 then 85 | set chan to 1 86 | else if num is greater than 128 and num is less than 256 then 87 | set chan to 2 88 | else if num is greater than 255 and num is less than 383 then 89 | set chan to 3 90 | else if num is greater than 382 and num is less than 508 then 91 | set chan to 4 92 | end if 93 | return chan 94 | end calculateChan 95 | 96 | on calculateScene(num) 97 | set scene to integer 98 | if num is less than 129 then 99 | set scene to num - 1 100 | else if num is greater than 128 and num is less than 256 then 101 | set scene to num - 129 102 | else if num is greater than 255 and num is less than 383 then 103 | set scene to num - 256 104 | else if num is greater than 382 and num is less than 508 then 105 | set scene to num - 383 106 | end if 107 | 108 | return scene 109 | end calculateScene -------------------------------------------------------------------------------- /Mixing Desk Programming/Create CLQL scene recall.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create CL/QL scene recall 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.1 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Creates a midi cue to recall a scene on Yamaha CL/QL mixing desks 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.1 + can now colour parent groups 12 | -- v1.0 + init 13 | 14 | 15 | -- USER DEFINED VARIABLES ----------------- 16 | 17 | set userColor to "green" 18 | 19 | set colorParentGroups to TRUE -- set colour of any groups containing the recall group as well? 20 | 21 | set cueListName to "Main Cue List" -- Name of main cue list 22 | 23 | ---------- END OF USER DEFINED VARIABLES -- 24 | 25 | 26 | -- RUN SCRIPT ----------------------------- 27 | 28 | tell application id "com.figure53.Qlab.4" to tell front workspace 29 | -- set scene number to recall 30 | display dialog "Please select a scene number to recall" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER" 31 | set sceneNumber to text returned of result as integer 32 | 33 | -- Calculate variables to use in the midi cue 34 | set chanNum to my calculateChan(sceneNumber) 35 | set sceneNum to my calculateScene(sceneNumber) 36 | 37 | set sceneGroupName to "Scene " & sceneNumber 38 | 39 | -- Make overall group 40 | make type "Group" 41 | set sceneGroup to last item of (selected as list) 42 | set sceneGroupID to uniqueID of sceneGroup 43 | set mode of sceneGroup to timeline 44 | set q name of sceneGroup to sceneGroupName 45 | 46 | -- Make the midi program cue 47 | make type "Midi" 48 | set midiBank to last item of (selected as list) 49 | set midiBankID to uniqueID of midiBank 50 | set message type of midiBank to voice 51 | set command of midiBank to program_change 52 | set channel of midiBank to chanNum 53 | set byte one of midiBank to sceneNum 54 | move cue id midiBankID of parent of midiBank to end of sceneGroup 55 | set q name of midiBank to "Scene " & sceneNumber & ": Program Change" 56 | 57 | -- Color the group and any groups containing the group 58 | set q color of sceneGroup to userColor 59 | 60 | if colorParentGroups is TRUE 61 | set groupParent to parent of sceneGroup 62 | repeat 63 | if q name of groupParent is cueListName then 64 | exit repeat 65 | else 66 | set q color of groupParent to userColor 67 | set groupParent to parent of groupParent 68 | end if 69 | end repeat 70 | end if 71 | 72 | collapse sceneGroup 73 | 74 | end tell 75 | 76 | 77 | -- FUNCTIONS ------------------------------ 78 | 79 | -- Function to calculate the midi channel (used as a bank) 80 | on calculateChan(num) 81 | set chan to integer 82 | if num is less than 129 then 83 | set chan to 1 84 | else if num is greater than 128 and num is less than 256 then 85 | set chan to 2 86 | else if num is greater than 255 and num is less than 383 then 87 | set chan to 3 88 | else if num is greater than 382 and num is less than 508 then 89 | set chan to 4 90 | end if 91 | return chan 92 | end calculateChan 93 | 94 | on calculateScene(num) 95 | set scene to integer 96 | if num is less than 129 then 97 | set scene to num - 1 98 | else if num is greater than 128 and num is less than 256 then 99 | set scene to num - 129 100 | else if num is greater than 255 and num is less than 383 then 101 | set scene to num - 256 102 | else if num is greater than 382 and num is less than 508 then 103 | set scene to num - 383 104 | end if 105 | 106 | return scene 107 | end calculateScene -------------------------------------------------------------------------------- /Mixing Desk Programming/Create GLDSQ scene recall with name.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create GLD/SQ scene recall with name 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.2 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Creates a midi cue to recall a scene on Allen & Heath GLD/SQ mixing desks. Allows you to name the scene 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.2 + runs as separate process 12 | -- v1.1 + can now colour parent groups 13 | -- v1.0 + init 14 | 15 | 16 | -- USER DEFINED VARIABLES ----------------- 17 | 18 | set userColor to "green" -- the colour of the resulting recall cue 19 | 20 | set colorParentGroups to true -- set colour of any groups containing the recall group as well? 21 | 22 | set cueListName to "Main Cue List" -- Name of main cue list 23 | 24 | ---------- END OF USER DEFINED VARIABLES -- 25 | 26 | 27 | -- RUN SCRIPT ----------------------------- 28 | 29 | tell application id "com.figure53.Qlab.4" to tell front workspace 30 | -- Set scene number to recall 31 | display dialog "Please select a scene number to recall" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER" 32 | set sceneNumber to text returned of result as integer 33 | display dialog "What would you like to name this scene" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NAME" 34 | set sceneName to text returned of result 35 | 36 | end tell 37 | 38 | set bankNumHex to calculateBank(sceneNumber) 39 | set sceneNumHex to calculateScene(sceneNumber) 40 | 41 | set bankMessage to "B0 00 " & bankNumHex 42 | set sceneMessage to " C0 " & sceneNumHex 43 | 44 | set sceneGroupName to "Scene " & sceneNumber & ": " & sceneName 45 | tell application id "com.figure53.Qlab.4" to tell front workspace 46 | 47 | -- Make overall group 48 | make type "Group" 49 | set sceneGroup to first item of (selected as list) 50 | set sceneGroupIsIn to parent of sceneGroup 51 | set mode of sceneGroup to timeline 52 | set q name of sceneGroup to sceneGroupName 53 | 54 | -- Make the Bank + Program Select midi cue 55 | make type "Midi" 56 | set midiBank to first item of (selected as list) 57 | set midiBankID to uniqueID of midiBank 58 | set message type of midiBank to sysex 59 | set sysex message of midiBank to bankMessage & sceneMessage 60 | move cue id midiBankID of parent of midiBank to end of sceneGroup 61 | set pre wait of midiBank to 0 62 | set q name of midiBank to "Scene " & sceneNumber & ": bank + program change" 63 | 64 | -- Color the group and any groups containing the group 65 | set q color of sceneGroup to userColor 66 | 67 | if colorParentGroups is true then 68 | set groupParent to parent of sceneGroup 69 | repeat 70 | if q name of groupParent is cueListName then 71 | exit repeat 72 | else 73 | set q color of groupParent to userColor 74 | set groupParent to parent of groupParent 75 | end if 76 | end repeat 77 | end if 78 | 79 | collapse sceneGroup 80 | 81 | end tell 82 | 83 | 84 | -- FUNCTIONS ------------------------------ 85 | 86 | on calculateBank(num) 87 | set bank to integer 88 | if num is less than 129 then 89 | set bank to "00" 90 | end if 91 | if num is greater than 128 and num is less than 257 then 92 | set bank to "01" 93 | end if 94 | if num is greater than 256 and num is less than 385 then 95 | set bank to "02" 96 | end if 97 | if num is greater than 384 and num is less than 501 then 98 | set bank to "03" 99 | end if 100 | 101 | 102 | set bankNumHex to bank 103 | end calculateBank 104 | 105 | on calculateScene(num) 106 | set scene to integer 107 | if num is less than 129 then 108 | set scene to num - 1 109 | end if 110 | if num is greater than 128 and num is less than 257 then 111 | set scene to (num - 129) 112 | end if 113 | if num is greater than 256 and num is less than 385 then 114 | set scene to (num - 257) 115 | end if 116 | if num is greater than 384 and num is less than 501 then 117 | set scene to (num - 385) 118 | end if 119 | 120 | set sceneHex to do shell script "perl -e 'printf(\"%02X\", " & scene & ")'" 121 | 122 | set sceneNumHex to sceneHex 123 | end calculateScene -------------------------------------------------------------------------------- /Mixing Desk Programming/Create GLDSQ scene recall.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create GLD/SQ scene recall 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.2 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Creates a midi cue to recall a scene on Allen & Heath GLD / SQ mixing desks 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.2 + runs as separate process 12 | -- v1.1 + can now colour parent groups 13 | -- v1.0 + init 14 | 15 | 16 | -- USER DEFINED VARIABLES ----------------- 17 | 18 | set userColor to "green" -- the colour of the resulting recall cue 19 | 20 | set colorParentGroups to true -- set colour of any groups containing the recall group as well? 21 | 22 | set cueListName to "Main Cue List" -- Name of main cue list 23 | 24 | ---------- END OF USER DEFINED VARIABLES -- 25 | 26 | 27 | -- RUN SCRIPT ----------------------------- 28 | 29 | tell application id "com.figure53.Qlab.4" to tell front workspace 30 | -- Set scene number to recall 31 | display dialog "Please select a scene number to recall" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER" 32 | set sceneNumber to text returned of result as integer 33 | 34 | end tell 35 | 36 | set bankNumHex to calculateBank(sceneNumber) 37 | set sceneNumHex to calculateScene(sceneNumber) 38 | 39 | set bankMessage to "B0 00 " & bankNumHex 40 | set sceneMessage to " C0 " & sceneNumHex 41 | 42 | set sceneGroupName to "Scene " & sceneNumber 43 | tell application id "com.figure53.Qlab.4" to tell front workspace 44 | 45 | -- Make overall group 46 | make type "Group" 47 | set sceneGroup to first item of (selected as list) 48 | set sceneGroupIsIn to parent of sceneGroup 49 | set mode of sceneGroup to timeline 50 | set q name of sceneGroup to sceneGroupName 51 | 52 | -- Make the Bank + Program midi cue 53 | make type "Midi" 54 | set midiBank to first item of (selected as list) 55 | set midiBankID to uniqueID of midiBank 56 | set message type of midiBank to sysex 57 | set sysex message of midiBank to bankMessage & sceneMessage 58 | move cue id midiBankID of parent of midiBank to end of sceneGroup 59 | set pre wait of midiBank to 0 60 | set q name of midiBank to "Scene " & sceneNumber & ": bank + program change" 61 | 62 | -- Color the group and any groups containing the group 63 | set q color of sceneGroup to userColor 64 | 65 | if colorParentGroups is true then 66 | set groupParent to parent of sceneGroup 67 | repeat 68 | if q name of groupParent is cueListName then 69 | exit repeat 70 | else 71 | set q color of groupParent to userColor 72 | set groupParent to parent of groupParent 73 | end if 74 | end repeat 75 | end if 76 | 77 | collapse sceneGroup 78 | 79 | end tell 80 | 81 | 82 | -- FUNCTIONS ------------------------------ 83 | 84 | on calculateBank(num) 85 | set bank to integer 86 | if num is less than 129 then 87 | set bank to "00" 88 | end if 89 | if num is greater than 128 and num is less than 257 then 90 | set bank to "01" 91 | end if 92 | if num is greater than 256 and num is less than 385 then 93 | set bank to "02" 94 | end if 95 | if num is greater than 384 and num is less than 501 then 96 | set bank to "03" 97 | end if 98 | 99 | 100 | set bankNumHex to bank 101 | end calculateBank 102 | 103 | on calculateScene(num) 104 | set scene to integer 105 | if num is less than 129 then 106 | set scene to num - 1 107 | end if 108 | if num is greater than 128 and num is less than 257 then 109 | set scene to (num - 129) 110 | end if 111 | if num is greater than 256 and num is less than 385 then 112 | set scene to (num - 257) 113 | end if 114 | if num is greater than 384 and num is less than 501 then 115 | set scene to (num - 385) 116 | end if 117 | 118 | set sceneHex to do shell script "perl -e 'printf(\"%02X\", " & scene & ")'" 119 | 120 | set sceneNumHex to sceneHex 121 | end calculateScene -------------------------------------------------------------------------------- /Mixing Desk Programming/Create PM scene recall with name.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create PM scene recall with name 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Creates a midi cue to recall a scene on Yamaha Rivage PM mixing desks. Allows you to name the scene 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.0 + moved common functions to external script 12 | 13 | 14 | -- USER DEFINED VARIABLES ----------------- 15 | 16 | set userColor to "green" -- the colour of groups containing midi recalls 17 | 18 | set colorParentGroups to true -- set colour of any groups containing the recall group as well? 19 | 20 | set cueListName to "Main Cue List" -- Name of main cue list 21 | 22 | ---------- END OF USER DEFINED VARIABLES -- 23 | 24 | 25 | property util : script "Applescript Utilities" 26 | 27 | 28 | -- RUN SCRIPT ----------------------------- 29 | 30 | tell application id "com.figure53.Qlab.4" to tell front workspace 31 | -- set scene number to recall 32 | display dialog "Please select a scene number to recall" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER" 33 | set sceneNumber to text returned of result as string 34 | 35 | -- set midi command to recall 36 | display dialog "Please select the midi program change to recall, in the format \"Channel Value\"" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "MIDI PROGRAM CHANGE" 37 | set midiCommandString to text returned of result as string 38 | 39 | -- set name of cue 40 | display dialog "What would you like to name this scene" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NAME" 41 | set sceneName to text returned of result 42 | 43 | -- calculate the channel and value 44 | set midiCommandList to util's splitString(midiCommandString, " ") 45 | set chanNum to item 1 of midiCommandList 46 | set valueNum to item 2 of midiCommandList 47 | set valueNum to valueNum - 1 48 | 49 | set sceneGroupName to "Scene " & sceneNumber & ": " & sceneName 50 | 51 | -- Make overall group 52 | make type "Group" 53 | set sceneGroup to last item of (selected as list) 54 | set sceneGroupID to uniqueID of sceneGroup 55 | set mode of sceneGroup to timeline 56 | set q name of sceneGroup to sceneGroupName 57 | 58 | -- Make the midi program cue 59 | make type "Midi" 60 | set midiBank to last item of (selected as list) 61 | set midiBankID to uniqueID of midiBank 62 | set message type of midiBank to voice 63 | set command of midiBank to program_change 64 | set channel of midiBank to chanNum 65 | set byte one of midiBank to valueNum 66 | move cue id midiBankID of parent of midiBank to end of sceneGroup 67 | set q name of midiBank to "Scene " & sceneNumber & ": Program Change" 68 | 69 | -- Color the group and any groups containing the group 70 | set q color of sceneGroup to userColor 71 | 72 | if colorParentGroups is true then 73 | set groupParent to parent of sceneGroup 74 | repeat 75 | if q name of groupParent is cueListName then 76 | exit repeat 77 | else 78 | set q color of groupParent to userColor 79 | set groupParent to parent of groupParent 80 | end if 81 | end repeat 82 | end if 83 | 84 | collapse sceneGroup 85 | 86 | end tell -------------------------------------------------------------------------------- /Mixing Desk Programming/Create PM scene recall.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create PM scene recall 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Creates a midi cue to recall a scene on Yamaha Rivage PM mixing desks 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.0 + moved common functions to external script 12 | 13 | 14 | -- USER DEFINED VARIABLES ----------------- 15 | 16 | set userColor to "green" 17 | 18 | set colorParentGroups to true -- set colour of any groups containing the recall group as well? 19 | 20 | set cueListName to "Main Cue List" -- Name of main cue list 21 | 22 | ---------- END OF USER DEFINED VARIABLES -- 23 | 24 | 25 | property util : script "Applescript Utilities" 26 | 27 | 28 | -- RUN SCRIPT ----------------------------- 29 | 30 | tell application id "com.figure53.Qlab.4" to tell front workspace 31 | -- set scene number to recall 32 | display dialog "Please select a scene number to recall" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER" 33 | set sceneNumber to text returned of result as string 34 | 35 | -- set midi command to recall 36 | display dialog "Please select the midi program change to recall, in the format \"Channel Value\"" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "MIDI PROGRAM CHANGE" 37 | set midiCommandString to text returned of result as string 38 | 39 | -- calculate the channel and value 40 | set midiCommandList to util's splitString(midiCommandString, " ") 41 | set chanNum to item 1 of midiCommandList 42 | set valueNum to item 2 of midiCommandList 43 | set valueNum to valueNum - 1 44 | 45 | set sceneGroupName to "Scene " & sceneNumber 46 | 47 | -- Make overall group 48 | make type "Group" 49 | set sceneGroup to last item of (selected as list) 50 | set sceneGroupID to uniqueID of sceneGroup 51 | set mode of sceneGroup to timeline 52 | set q name of sceneGroup to sceneGroupName 53 | 54 | -- Make the midi program cue 55 | make type "Midi" 56 | set midiBank to last item of (selected as list) 57 | set midiBankID to uniqueID of midiBank 58 | set message type of midiBank to voice 59 | set command of midiBank to program_change 60 | set channel of midiBank to chanNum 61 | set byte one of midiBank to valueNum 62 | move cue id midiBankID of parent of midiBank to end of sceneGroup 63 | set q name of midiBank to "Scene " & sceneNumber & ": Program Change" 64 | 65 | -- Color the group and any groups containing the group 66 | set q color of sceneGroup to userColor 67 | 68 | if colorParentGroups is true then 69 | set groupParent to parent of sceneGroup 70 | repeat 71 | if q name of groupParent is cueListName then 72 | exit repeat 73 | else 74 | set q color of groupParent to userColor 75 | set groupParent to parent of groupParent 76 | end if 77 | end repeat 78 | end if 79 | 80 | collapse sceneGroup 81 | 82 | end tell -------------------------------------------------------------------------------- /Mixing Desk Programming/Offset midi triggers of selected cues.applescript: -------------------------------------------------------------------------------- 1 | -- @description Offset midi triggers of selected cues 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Offsets the value of a program change used to trigger the selected cues, based on using scene recalls from a Yamaha QL5 mixing desk to trigger Qlab. If you insert a scene on the desk, run this script with offset "+1" on all cues after that point. 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.0 + init 12 | 13 | 14 | tell application id "com.figure53.Qlab.4" 15 | tell front workspace 16 | set selectedCues to (selected as list) 17 | 18 | display dialog "By how much would you like to offset the midi trigger value of the selected cues?" default answer "" buttons {"Offset", "Cancel"} cancel button "Cancel" default button "Offset" 19 | set offsetAmount to text returned of result as integer 20 | 21 | repeat with eachCue in selectedCues 22 | set oldMidiTrigger to midi trigger of eachCue 23 | set oldMidiCommand to midi command of eachCue 24 | set oldByteOne to midi byte one of eachCue 25 | set oldByteTwo to midi byte two of eachCue 26 | 27 | if oldMidiCommand is program_change then 28 | if (oldByteOne + offsetAmount) is less than or equal to 127 then 29 | set midi trigger of eachCue to oldMidiTrigger 30 | --set midi command of eachCue to program_change 31 | set midi byte one of eachCue to oldByteOne + offsetAmount 32 | --set midi byte two of eachCue to oldByteTwo + offsetAmount 33 | else 34 | set midi trigger of eachCue to oldMidiTrigger 35 | set midi byte one of eachCue to (oldByteOne + offsetAmount - 128) 36 | display dialog "ALERT: Cue number " & q number of eachCue & " requires a change of midi channel" 37 | end if 38 | end if 39 | 40 | end repeat 41 | 42 | end tell 43 | end tell -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Qlab Scripts 2 | 3 | [![GitHub license](https://img.shields.io/github/license/bsmith96/Qlab-Scripts.svg)](https://github.com/bsmith96/Qlab-Scripts/blob/master/LICENSE) 4 | [![GitHub release](https://img.shields.io/github/release/bsmith96/Qlab-Scripts.svg)](https://GitHub.com/bsmith96/Qlab-Scripts/releases/) 5 | 6 | [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/F1F120U9I) 7 | 8 | ## Introduction 9 | 10 | This is a collection of scripts for Figure 53's **Qlab** show control software. I started out working with scripts which have been shared freely online, and evolved into editing these scripts, and more recently creating brand new scripts to automate parts of my workflow. 11 | 12 | In all scripts that I have adapted from publically available versions, I have credited the original author in the `@source` tag, in the header of the file. 13 | 14 | Some scripts are meant for regular use while programming (such as level bumps, creating fades for cues, and creating mixing desk recall midi cues). Some scripts are intended for one-off use (such as creating line-check cues). A few scripts are very specifically designed for my workflow ("choose desk to program" and "speaker polarity check" specifically), so unless you recreate my qlab template directly, these may not be as useful. However, they could still be useful if you would like to adapt them! 15 | 16 | ## Installation 17 | 18 | These scripts can either run within Qlab as script cues, though I recommend that instead, the be called from script cues and run externally. 19 | 20 | To install the scripts as script cues, use the script "~/00 Import scripts to cues.applescript". Run the script from Script Editor with your qlab file open, and it will allow you to select the script or scripts you wish to import. If you import multiple scripts, it will create script cues and write the scripts (with less header information) into the cue. If you import a single script and currently have a script cue selected, it will write the script into that cue. 21 | 22 | ### Script Library 23 | 24 | To install the scripts to your user's Library folder, in "Script Libraries", run the script "~/00 Import all to library.applescript" from the script editor. This gives you two options: install from a local folder (if you have downloaded a specific release, to work with a Qlab file you have already set up) or directly from github (if you have an internet connection and want the most up to date versions). 25 | 26 | Within Qlab, call the script (usually from within a `tell application "Qlab" to tell front workspace` block) like so: 27 | 28 | `tell script "Mixing Desk Programming/Choose Desk to program" to run` 29 | 30 | ## User Defined Variables 31 | 32 | Many scripts also contain User Defined Variables. With these, when you call the script within Qlab, you can declare these variables globally and set them from within Qlab. This is particularly useful for using the same script for different purposes: e.g. you could have 2 versions of `Fades/Create fade`, one which creates a fade down and one a fade up. The syntax for this would be as follows: 33 | 34 | ```applescript 35 | global userLevel, userPrefix 36 | set userLevel to 6 37 | set userPrefix to "Fade up: " 38 | ``` 39 | 40 | ```applescript 41 | global userLevel, userPrefix 42 | set userLevel to -6 43 | set userPrefix to "Fade down: " 44 | ``` 45 | 46 | ## Variables set within Qlab 47 | 48 | Many of these variables will stay the same for your template from show to show - some others depend on the design. These are set from within Qlab, as the notes of a cue. 49 | 50 | Using the example `Levels/Bump level`, the variables from Qlab are `audioChannelCount` and `minAudioLevel`. 51 | 52 | To set these variables, you must set as a User Defined Variable `variableCueListName`. This is the cue list that you have stored your notes cues in. I recommend using Memo cues. In this instance, you would name one cue `Output channel count` and the other `Min audio level`. You do not need numbers for those cues. 53 | 54 | The total list of Qlab Note variables required for the entire script library is: 55 | - Output channel count 56 | - Min audio level 57 | - Output channel names [this should simply be a list separated by ", "] 58 | - Line Checks: output level [my default is -12] 59 | - Line Checks: sub level [my default is -12] 60 | 61 | ## Template cues 62 | 63 | The current generation of scripts in `Routing` work using templates. This means you can quickly and easily set levels, crosspoints, etc. to multiple 'defaults' via a quick dialog box. 64 | 65 | To use these, you must set `templateCueListName` and `templateGroupCueName` in User Defined Variables. It will then use every audio file in the group cue as an option, and copy the appropriate routing from there, up to the count of your "Output Channel Count" value. 66 | 67 | The options include: 68 | - __Route tracks to template__: Sets the faders of the audio cue, ignoring master and crosspoints. 69 | - __Set crosspoints to template__: Sets the crosspoints of the audio cue, ignoring master and faders. 70 | - Append the template name with " - X" where X is the number of inputs of the audio file. e.g. if you run the script on a mono file, send it at 0 to every output; if you run the script on a stereo file, you may have several different options. If there is only one option for the number of tracks on the selected cue, it will set routing automatically. 71 | - __Set gangs to template__: Sets values of gangs. 72 | - If you append the template name with " - X", then it will also set gangs of X rows of crosspoints. If you leave the template name without this, the script will simple set gangs of faders. 73 | 74 | `Route tracks to template` also has an option to append the name of the template onto the end of the cue name: this is designed for Click Track routing primarily. 75 | 76 | ## Tags 77 | 78 | - `@description` Name of the script 79 | - `@author` Most recent author of the script 80 | - `@link` Link to the author's website 81 | - `@source` Where scripts are taken from another source, or adapted from one, that author is listed here 82 | - `@version` Version of the script 83 | - `@testedmacos` The most recent version of MacOS that the script has been tested on 84 | - `@testedqlab` The most recent version of Qlab that the script has been tested on 85 | - `@about` A description of the script 86 | - `@separateprocess` TRUE or FALSE, whether the script needs to run in a separate process within Qlab 87 | - `@changelog` Changes for this version of the script 88 | -------------------------------------------------------------------------------- /Routing/Route Soundcheck tracks to template.applescript: -------------------------------------------------------------------------------- 1 | -- @description Route Soundcheck tracks to template 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.10 7 | -- @about Routes soundcheck songs to specific or additional channels based on templates 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.0 + moved common functions to external script 12 | -- v1.5 + Allows assignment of UDVs from the script calling this one 13 | -- v1.4 + Added error catching 14 | -- v1.3 + Takes number of output channels from the notes of cues, to streamline editing for new projects 15 | -- v1.2 + Renames script cue with the current routing 16 | -- v1.1 + Toggles template name for additional routing ("+Sub" while off, "-Sub" while on) 17 | -- + Toggles template name for absolute routing (adds " <-", and sets all additional to "+") 18 | 19 | 20 | -- USER DEFINED VARIABLES ----------------- 21 | 22 | try -- if global variables are given when this script is called by another, use those variables 23 | variableCueListName 24 | on error 25 | set variableCueListName to "Other scripts & utilities" -- cue list containing Script Variables 26 | end try 27 | 28 | try 29 | templateCueListName 30 | on error 31 | set templateCueListName to "Other scripts & utilities" -- cue list containing template cues 32 | end try 33 | 34 | try 35 | templateGroupCueName 36 | on error 37 | set templateGroupCueName to "Soundcheck routing templates" -- group cue containing all template cues 38 | end try 39 | 40 | try 41 | cueListToRoute 42 | on error 43 | set cueListToRoute to "Soundcheck" -- the name of the soundcheck cue list. If this is blank, it will use selected cues 44 | end try 45 | 46 | try 47 | displayCurrentStateCueNumber 48 | on error 49 | set displayCurrentStateCueNumber to "Route S-Check" -- the number of the cue which runs or triggers this script 50 | end try 51 | 52 | ---------- END OF USER DEFINED VARIABLES -- 53 | 54 | 55 | -- VARIABLES FROM QLAB NOTES -------------- 56 | 57 | tell application id "com.figure53.Qlab.4" to tell front workspace 58 | set audioChannelCount to notes of (first cue of (first cue list whose q name is variableCueListName) whose q name is "Output channel count") -- total number of Qlab output 59 | end tell 60 | 61 | ------------------ END OF QLAB VARIABLES -- 62 | 63 | 64 | property util : script "Applescript Utilities" 65 | 66 | 67 | ---- RUN SCRIPT --------------------------- 68 | 69 | tell application id "com.figure53.Qlab.4" to tell front workspace 70 | 71 | set containerList to (first cue list whose q name is templateCueListName) 72 | 73 | set containerCue to first cue in containerList whose q name is templateGroupCueName 74 | 75 | set routingTemplates to (cues in containerCue) 76 | set routingNames to {} 77 | 78 | repeat with eachCue in routingTemplates 79 | set end of routingNames to (q name of eachCue) 80 | end repeat 81 | 82 | set whatTemplate to choose from list routingNames 83 | if whatTemplate is false then 84 | return 85 | end if 86 | 87 | set whatTemplateCue to first cue in containerCue whose q name is whatTemplate 88 | 89 | if cueListToRoute is not "" then 90 | set selectedCues to (cues in (first cue list whose q name is cueListToRoute) as list) 91 | else 92 | set selectedCues to (selected as list) 93 | end if 94 | 95 | if (whatTemplate as string) starts with "+" or (whatTemplate as string) starts with "-" then -- for additional routing e.g. add +Subs, +Front Fills. 96 | repeat with eachCue in selectedCues 97 | set cueType to q type of eachCue 98 | if cueType is "Audio" then 99 | repeat with eachChannel from 1 to audioChannelCount 100 | set theLevel to getLevel whatTemplateCue row 0 column eachChannel 101 | if theLevel is greater than -60 then -- checks this is a channel to be affected 102 | if (getLevel eachCue row 0 column eachChannel) is not theLevel then -- toggles 103 | setLevel eachCue row 0 column eachChannel db theLevel 104 | my renameAdditionalTemplate(whatTemplateCue, "-") 105 | set additional to "add" 106 | else 107 | setLevel eachCue row 0 column eachChannel db -120 108 | my renameAdditionalTemplate(whatTemplateCue, "+") 109 | set additional to "remove" 110 | end if 111 | end if 112 | end repeat 113 | end if 114 | end repeat 115 | log whatTemplate & " absolute" 116 | 117 | try 118 | set scriptCue to cue displayCurrentStateCueNumber 119 | set scriptCueOldName to q name of scriptCue 120 | 121 | if additional is "add" then 122 | set q name of scriptCue to scriptCueOldName & " " & whatTemplate 123 | else if additional is "remove" then 124 | set newTemplateName to q name of whatTemplateCue 125 | set q name of scriptCue to util's findAndReplaceInText(scriptCueOldName, " " & newTemplateName, "") 126 | end if 127 | end try 128 | 129 | else -- for absolute routing, e.g. pros, a Soundcheck channel 130 | repeat with eachCue in selectedCues 131 | 132 | set cueType to q type of eachCue 133 | if cueType is "Audio" then 134 | repeat with eachChannel from 1 to audioChannelCount 135 | set theLevel to getLevel whatTemplateCue row 0 column eachChannel 136 | setLevel eachCue row 0 column eachChannel db theLevel 137 | end repeat 138 | end if 139 | 140 | end repeat 141 | my renameAbsoluteTemplate(whatTemplateCue, routingTemplates, displayCurrentStateCueNumber) 142 | 143 | log whatTemplate & " not absolute" 144 | end if 145 | 146 | 147 | end tell 148 | 149 | 150 | -- FUNCTIONS ------------------------------ 151 | 152 | -- Rename additional routing template cues based on the current state. 153 | -- If current state is on, prefix becomes "-". 154 | -- If current state is off, prefix becomes "+" 155 | 156 | on renameAdditionalTemplate(theTemplate, prefix) 157 | tell application id "com.figure53.Qlab.4" to tell front workspace 158 | set oldTemplateName to q name of theTemplate 159 | set newTemplateName to items 2 thru -1 of (oldTemplateName as string) 160 | set newTemplateName to prefix & newTemplateName 161 | set q name of theTemplate to newTemplateName 162 | end tell 163 | end renameAdditionalTemplate 164 | 165 | -- Rename absolute routing template cues based on the current state. 166 | -- Most recently recalled is appended with " <-". 167 | -- All other cues have " <-" cleared, if present. 168 | -- All absolute routing is set to prefix "+", since it will be turned off by the template. 169 | 170 | on renameAbsoluteTemplate(theTemplate, allTemplates, updateCueNumber) 171 | tell application id "com.figure53.Qlab.4" to tell front workspace 172 | repeat with eachTemplate in allTemplates 173 | if q name of eachTemplate ends with " <-" then 174 | set eachOldName to q name of eachTemplate 175 | set q name of eachTemplate to (items 1 thru -4 of eachOldName) as string 176 | else if q name of eachTemplate starts with "+" or q name of eachTemplate starts with "-" then 177 | my renameAdditionalTemplate(eachTemplate, "+") 178 | end if 179 | end repeat 180 | 181 | set oldTemplateName to q name of theTemplate 182 | set newTemplateName to oldTemplateName as string 183 | set newTemplateName to newTemplateName & " <-" 184 | set q name of theTemplate to newTemplateName 185 | 186 | --try 187 | set scriptCue to cue updateCueNumber 188 | set q name of scriptCue to oldTemplateName 189 | --end try 190 | 191 | end tell 192 | end renameAbsoluteTemplate -------------------------------------------------------------------------------- /Routing/Route click tracks to channels.applescript: -------------------------------------------------------------------------------- 1 | -- @description Route click tracks to channels 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Create a version of this script for each track you are using, and run each using a different hotkey. 8 | -- @separateprocess TRUE 9 | 10 | 11 | -- USER DEFINED VARIABLES ----------------- 12 | 13 | set userChannels to {12, 13} -- the qlab output tracks for this stem or click 14 | 15 | set userLevel to 0 -- the level for click tracks to route at 16 | 17 | ---------- END OF USER DEFINED VARIABLES -- 18 | 19 | 20 | ---- RUN SCRIPT --------------------------- 21 | 22 | tell application id "com.figure53.Qlab.4" to tell front workspace 23 | 24 | set selectedCues to (selected as list) 25 | 26 | repeat with eachCue in selectedCues 27 | 28 | set cueType to q type of eachCue 29 | if cueType is "Audio" then 30 | repeat with eachChannel in userChannels 31 | setLevel eachCue row 0 column eachChannel db userLevel 32 | end repeat 33 | end if 34 | 35 | end repeat 36 | 37 | end tell -------------------------------------------------------------------------------- /Routing/Route tracks to template.applescript: -------------------------------------------------------------------------------- 1 | -- @description Route tracks to template 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.1 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Routes the selected audio track/s the same as a selected template cue 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.1 + will now correctly route audio if it is ganged differently to the routing option 12 | -- v2.0 + moved common functions to external script 13 | -- v1.4 + works with videos as well 14 | -- v1.3 + allows assignment of UDVs from the script calling this one 15 | -- v1.2 + added option to turn off renaming cues 16 | -- + added error catching 17 | -- v1.1 + takes number of output channels from the notes of cues, to streamline editing for new projects 18 | 19 | 20 | -- USER DEFINED VARIABLES ----------------- 21 | 22 | try -- if global variables are given when this script is called by another, use those variables 23 | renameCues 24 | on error 25 | set renameCues to false -- whether or not to append cues with the name of the chosen template 26 | end try 27 | 28 | try 29 | variableCueListName 30 | on error 31 | set variableCueListName to "Other scripts & utilities" -- cue list containing Script Variables 32 | end try 33 | 34 | try 35 | templateCueListName 36 | on error 37 | set templateCueListName to "Other scripts & utilities" -- cue list containing template cues 38 | end try 39 | 40 | try 41 | templateGroupCueName 42 | on error 43 | set templateGroupCueName to "Click track routing templates" -- group cue containing all template cues 44 | end try 45 | 46 | ---------- END OF USER DEFINED VARIABLES -- 47 | 48 | 49 | -- VARIABLES FROM QLAB NOTES -------------- 50 | 51 | tell application id "com.figure53.Qlab.4" to tell front workspace 52 | set audioChannelCount to notes of (first cue of (first cue list whose q name is variableCueListName) whose q name is "Output channel count") -- total number of Qlab output 53 | end tell 54 | 55 | ------------------ END OF QLAB VARIABLES -- 56 | 57 | 58 | property util : script "Applescript Utilities" 59 | 60 | 61 | ---- RUN SCRIPT --------------------------- 62 | 63 | tell application id "com.figure53.Qlab.4" to tell front workspace 64 | 65 | set containerList to (first cue list whose q name is templateCueListName) 66 | 67 | set containerCue to first cue in containerList whose q name is templateGroupCueName 68 | 69 | set routingTemplates to (cues in containerCue) 70 | set routingNames to {} 71 | 72 | repeat with eachCue in routingTemplates 73 | set end of routingNames to (q name of eachCue) 74 | end repeat 75 | 76 | set whatTemplate to choose from list routingNames 77 | if whatTemplate is false then 78 | return 79 | end if 80 | 81 | set whatTemplateCue to first cue in containerCue whose q name is whatTemplate 82 | 83 | set selectedCues to (selected as list) 84 | 85 | repeat with eachCue in selectedCues 86 | 87 | set cueType to q type of eachCue 88 | if cueType is in {"Audio", "Video"} then 89 | repeat with eachChannel from 1 to audioChannelCount 90 | set eachGang to getGang eachCue row 0 column eachChannel 91 | if eachGang is missing value then 92 | set theLevel to getLevel whatTemplateCue row 0 column eachChannel 93 | setLevel eachCue row 0 column eachChannel db theLevel 94 | else 95 | setGang eachCue row 0 column eachChannel gang "" 96 | set theLevel to getLevel whatTemplateCue row 0 column eachChannel 97 | setLevel eachCue row 0 column eachChannel db theLevel 98 | setGang eachCue row 0 column eachChannel gang eachGang 99 | end if 100 | end repeat 101 | if renameCues is true then 102 | my renameCue(eachCue, whatTemplate) 103 | end if 104 | end if 105 | 106 | end repeat 107 | 108 | end tell 109 | 110 | 111 | -- FUNCTIONS ------------------------------ 112 | 113 | on renameCue(theCue, theTemplate) 114 | tell application id "com.figure53.Qlab.4" to tell front workspace 115 | set oldName to q display name of theCue 116 | set oldNameList to util's splitString(oldName, " | ") 117 | set oldName to item 1 of oldNameList 118 | set newName to oldName & " | " & theTemplate 119 | set q name of theCue to newName 120 | end tell 121 | end renameCue -------------------------------------------------------------------------------- /Routing/Set crosspoints to template.applescript: -------------------------------------------------------------------------------- 1 | -- @description Set crosspoints to template 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.1 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Set the crosspoints of the selected cue to match a selected template cue 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.1 + will now correctly set crosspoints where they are ganged differently to the selected routing 12 | -- v2.0 + moved common functions to external script 13 | -- v1.5 + works with videos as well 14 | -- v1.4 + allows assignment of UDVs from the script calling this one 15 | -- v1.3 + Added error catching 16 | 17 | 18 | -- USER DEFINED VARIABLES ----------------- 19 | 20 | try -- if global variables are given when this script is called by another, use those variables 21 | variableCueListName 22 | on error 23 | set variableCueListName to "Other scripts & utilities" -- cue list containing Script Variables 24 | end try 25 | 26 | try 27 | templateCueListName 28 | on error 29 | set templateCueListName to "Other scripts & utilities" -- cue list containing template cues 30 | end try 31 | 32 | try 33 | templateGroupCueName 34 | on error 35 | set templateGroupCueName to "Crosspoints routing templates" -- group cue containing all template cues 36 | end try 37 | 38 | ---------- END OF USER DEFINED VARIABLES -- 39 | 40 | 41 | -- VARIABLES FROM QLAB NOTES -------------- 42 | 43 | tell application id "com.figure53.Qlab.4" to tell front workspace 44 | set audioChannelCount to notes of (first cue of (first cue list whose q name is variableCueListName) whose q name is "Output channel count") -- total number of Qlab output 45 | end tell 46 | 47 | ------------------ END OF QLAB VARIABLES -- 48 | 49 | 50 | property util : script "Applescript Utilities" 51 | 52 | 53 | ---- RUN SCRIPT --------------------------- 54 | 55 | tell application id "com.figure53.Qlab.4" to tell front workspace 56 | 57 | set containerList to (first cue list whose q name is templateCueListName) 58 | 59 | set containerCue to first cue in containerList whose q name is templateGroupCueName 60 | 61 | set routingTemplates to (cues in containerCue) 62 | set routingNames to {} 63 | set routingNumbers to {} 64 | 65 | repeat with eachCue in routingTemplates 66 | set end of routingNames to (q name of eachCue) 67 | end repeat 68 | 69 | set selectedCues to (selected as list) 70 | 71 | -- try to do it automatically 72 | try 73 | repeat with eachTemplate in routingNames 74 | set eachTemplateList to util's splitString((eachTemplate as string), " - ") 75 | set inputCountTemplate to item -1 of eachTemplateList as integer 76 | set end of routingNumbers to inputCountTemplate 77 | end repeat 78 | 79 | repeat with eachCue in selectedCues 80 | set inputCountCue to audio input channels of eachCue 81 | 82 | set inputCountMatches to {} 83 | repeat with eachTemplate from 1 to length of routingTemplates 84 | if inputCountCue as integer is equal to (item eachTemplate of routingNumbers as integer) then 85 | set end of inputCountMatches to eachTemplate 86 | end if 87 | end repeat 88 | 89 | if length of inputCountMatches is 1 then 90 | set whatTemplate to item (item 1 of inputCountMatches) of routingNames 91 | set whatTemplateCue to (first cue in containerCue whose q name is whatTemplate) 92 | set whatTemplateList to util's splitString((whatTemplate as string), " - ") 93 | set inputCount to item -1 of whatTemplateList as integer 94 | repeat with eachChannel from 1 to audioChannelCount 95 | repeat with eachInput from 1 to inputCount 96 | set eachGang to getGang eachCue row eachInput column eachChannel 97 | if eachGang is missing value then 98 | set theLevel to getLevel whatTemplateCue row eachInput column eachChannel 99 | setLevel eachCue row eachInput column eachChannel db theLevel 100 | else 101 | setGang eachCue row eachInput column eachChannel gang "" 102 | set theLevel to getLevel whatTemplateCue row eachInput column eachChannel 103 | setLevel eachCue row eachInput column eachChannel db theLevel 104 | setGang eachCue row eachInput column eachChannel gang eachGang 105 | end if 106 | end repeat 107 | end repeat 108 | else 109 | error 110 | end if 111 | end repeat 112 | return 113 | end try 114 | 115 | -- end of automatic section 116 | 117 | set whatTemplate to choose from list routingNames 118 | if whatTemplate is false then 119 | return 120 | end if 121 | 122 | set whatTemplateCue to first cue in containerCue whose q name is whatTemplate 123 | 124 | -- Get the number of inputs for the selected routing 125 | 126 | set whatTemplateList to util's splitString((whatTemplate as string), " - ") -- append the cue name with " - 2" where "2" is the number of cue input channels to affect. ## Only works up to 9 ## 127 | try 128 | set inputCount to item -1 of whatTemplateList as integer 129 | on error 130 | return 131 | end try 132 | 133 | repeat with eachCue in selectedCues 134 | 135 | set cueType to q type of eachCue 136 | if cueType is in {"Audio", "Video"} then 137 | repeat with eachChannel from 1 to audioChannelCount 138 | repeat with eachInput from 1 to inputCount 139 | set theLevel to getLevel whatTemplateCue row eachInput column eachChannel 140 | setLevel eachCue row eachInput column eachChannel db theLevel 141 | end repeat 142 | end repeat 143 | 144 | end if 145 | 146 | end repeat 147 | 148 | end tell 149 | 150 | 151 | -- FUNCTIONS ------------------------------ 152 | 153 | on renameCue(theCue, theTemplate) 154 | tell application id "com.figure53.Qlab.4" to tell front workspace 155 | set oldName to q display name of theCue 156 | set oldNameList to util's splitString(oldName, " | ") 157 | set oldName to item 1 of oldNameList 158 | set newName to oldName & " | " & theTemplate 159 | set q name of theCue to newName 160 | end tell 161 | end renameCue -------------------------------------------------------------------------------- /Routing/Set gangs to template.applescript: -------------------------------------------------------------------------------- 1 | -- @description Set gangs to template 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.0 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Create a version of this script for each track you are using, and run each using a different hotkey. 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.0 + moved common functions to external script 12 | -- v1.4 + works with videos as well 13 | -- v1.3 + allows assignment of UDVs from the script calling this one 14 | -- v1.2 + added error catching 15 | 16 | 17 | -- USER DEFINED VARIABLES ----------------- 18 | 19 | try -- if global variables are given when this script is called by another, use those variables 20 | variableCueListName 21 | on error 22 | set variableCueListName to "Other scripts & utilities" -- cue list containing Script Variables 23 | end try 24 | 25 | try 26 | templateCueListName 27 | on error 28 | set templateCueListName to "Other scripts & utilities" -- cue list containing template cues 29 | end try 30 | 31 | try 32 | templateGroupCueName 33 | on error 34 | set templateGroupCueName to "Gangs routing templates" -- group cue containing all template cues 35 | end try 36 | 37 | ---------- END OF USER DEFINED VARIABLES -- 38 | 39 | 40 | -- VARIABLES FROM QLAB NOTES -------------- 41 | 42 | tell application id "com.figure53.Qlab.4" to tell front workspace 43 | set audioChannelCount to notes of (first cue of (first cue list whose q name is variableCueListName) whose q name is "Output channel count") -- total number of Qlab output 44 | end tell 45 | 46 | ------------------ END OF QLAB VARIABLES -- 47 | 48 | 49 | property util : script "Applescript Utilities" 50 | 51 | 52 | ---- RUN SCRIPT --------------------------- 53 | 54 | tell application id "com.figure53.Qlab.4" to tell front workspace 55 | 56 | set containerList to (first cue list whose q name is templateCueListName) 57 | 58 | set containerCue to first cue in containerList whose q name is templateGroupCueName 59 | 60 | set routingTemplates to (cues in containerCue) 61 | set routingNames to {} 62 | 63 | repeat with eachCue in routingTemplates 64 | set end of routingNames to (q name of eachCue) 65 | end repeat 66 | 67 | set whatTemplate to choose from list routingNames 68 | if whatTemplate is false then 69 | return 70 | end if 71 | 72 | set whatTemplateCue to first cue in containerCue whose q name is whatTemplate 73 | 74 | set selectedCues to (selected as list) 75 | 76 | -- Get the number of inputs for the selected routing. To only affect the master level of each cue output channel, you can omit this from the template cue name 77 | 78 | set whatTemplateList to util's splitString((whatTemplate as string), " - ") -- append the cue name with " - 2" where "2" is the number of cue input channels to affect. To only affect levels and not crosspoints, you can omit this or enter "0". 79 | try 80 | set inputCount to item -1 of whatTemplateList as integer 81 | on error 82 | set inputCount to 0 83 | end try 84 | 85 | repeat with eachCue in selectedCues 86 | 87 | set cueType to q type of eachCue 88 | if cueType is in {"Audio", "Video"} then 89 | repeat with eachChannel from 1 to audioChannelCount 90 | repeat with eachInput from 0 to inputCount 91 | set theGang to getGang whatTemplateCue row eachInput column eachChannel 92 | try 93 | setGang eachCue row eachInput column eachChannel gang theGang 94 | on error 95 | setGang eachCue row eachInput column eachChannel gang "" 96 | end try 97 | end repeat 98 | end repeat 99 | 100 | end if 101 | 102 | end repeat 103 | 104 | end tell 105 | 106 | 107 | -- FUNCTIONS ------------------------------ 108 | 109 | on renameCue(theCue, theTemplate) 110 | tell application id "com.figure53.Qlab.4" to tell front workspace 111 | set oldName to q display name of theCue 112 | set oldNameList to util's splitString(oldName, " | ") 113 | set oldName to item 1 of oldNameList 114 | set newName to oldName & " | " & theTemplate 115 | set q name of theCue to newName 116 | end tell 117 | end renameCue -------------------------------------------------------------------------------- /Routing/WIP - Automatically route click tracks.applescript: -------------------------------------------------------------------------------- 1 | -- @description Automatically route click tracks 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Run this script with click tracks selected, it will automatically route them based on the filename. 8 | -- @separateprocess TRUE 9 | 10 | 11 | -- USER DEFINED VARIABLES ----------------- 12 | 13 | set userChannels to {"Track, 13, 14"} -- strings of each channel with the name followed by each track number, separated by ", " 14 | 15 | set clickChannel to {15} 16 | 17 | set userLevel to 0 -- the level for click tracks to route at 18 | 19 | ---------- END OF USER DEFINED VARIABLES -- 20 | 21 | 22 | ---- RUN SCRIPT --------------------------- 23 | 24 | tell application id "com.figure53.Qlab.4" to tell front workspace 25 | 26 | set selectedCues to (selected as list) 27 | 28 | repeat with eachChannel in userChannels 29 | set theResult to my splitString(eachChannel, ", ") 30 | set channelName to item 1 of theResult 31 | set channelNumbers to rest of theResult 32 | 33 | repeat with eachCue in selectedCues 34 | 35 | set cueType to q type of eachCue 36 | if cueType is "Audio" then 37 | set eachCueTarget to target of eachCue 38 | 39 | -- set targetFilename to file name of eachCueTarget 40 | 41 | if channelName is in targetFilename then 42 | routeToChannel(eachChannel, userLevel) 43 | else if "click" is in targetFilename then 44 | routeToChannel(clickChannel, userLevel) 45 | end if 46 | end if 47 | end repeat 48 | end repeat 49 | 50 | if "click" is in targetFilename then 51 | 52 | end tell 53 | 54 | 55 | -- FUNCTIONS ------------------------------ 56 | 57 | on splitString(theString, theDelimiter) 58 | -- save delimiters to restore old settings 59 | set oldDelimiters to AppleScript's text item delimiters 60 | -- set delimiters to delimiter to be used 61 | set AppleScript's text item delimiters to theDelimiter 62 | -- create the array 63 | set theArray to every text item of theString 64 | -- restore old setting 65 | set AppleScript's text item delimiters to oldDelimiters 66 | -- return the array 67 | return theArray 68 | end splitString 69 | 70 | on routeToChannel(theChannels, theLevel) 71 | 72 | tell application id "com.figure53.Qlab.4" to tell front workspace 73 | 74 | set selectedCues to (selected as list) 75 | 76 | repeat with eachCue in selectedCues 77 | 78 | set cueType to q type of theCue 79 | if cueType is "Audio" then 80 | repeat with eachChannel in theChannels 81 | setLevel theCue row 0 column eachChannel db theLevel 82 | end repeat 83 | end if 84 | 85 | end repeat 86 | 87 | end tell 88 | 89 | end routeToChannel -------------------------------------------------------------------------------- /SFX Variations/Create Selection cue in a separate cue list.applescript: -------------------------------------------------------------------------------- 1 | -- @description SFX VARIATIONS: Create selection cue in a separate cue list 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Creates a group and OSC cues in a separate cue list to select which variations to arm and disarm. Requires default group to be "timeline", and default network cue to be "Qlab message". 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.0 + moved common functions to external script 12 | -- v1.1 + fixed error catching 13 | -- v1.0 + init 14 | 15 | 16 | property util : script "Applescript Utilities" 17 | 18 | 19 | -- RUN SCRIPT ----------------------------- 20 | 21 | tell application id "com.figure53.Qlab.4" to tell front workspace 22 | 23 | -- Define variables 24 | set triggerName to "" 25 | set triggerAbb to "" 26 | set triggerOptions to {} 27 | set triggerOptionsAbb to {} 28 | set allVariations to "No" 29 | set currentPosition to 0 30 | 31 | -- Get the name & abbreviation of the variation 32 | set firstResults to (display dialog "What is the name of this Character, or Announcement?" default answer "" buttons {"OK", "Announcement", "Cancel"} default button "OK" cancel button "Cancel") 33 | if button returned of firstResults is "Announcement" then 34 | set triggerName to "Announcement" 35 | set triggerAbb to "ann" 36 | else 37 | set triggerName to text returned of firstResults 38 | display dialog "What abbreviation do you want to use?" default answer "" 39 | set triggerAbb to text returned of result 40 | end if 41 | 42 | -- If announcements was selected, automatically populate with Evening and Matinee first 43 | if triggerAbb is "ann" then 44 | -- Set Evening name 45 | util's insertItemInList("Evening", triggerOptions, 1) 46 | -- Set Evening abbreviation 47 | util's insertItemInList("eve", triggerOptionsAbb, 1) 48 | -- Set Matinee name 49 | util's insertItemInList("Matinee", triggerOptions, 2) 50 | -- Set Matinee abbreviation 51 | util's insertItemInList("mat", triggerOptionsAbb, 2) 52 | 53 | -- Allow additional variations of announcements to be entered 54 | repeat while allVariations is not "Yes" 55 | set listPosition to (length of triggerOptions) + 1 56 | set results to (display dialog "If there are any variations, in addition to Evening and Matinee, start entering them here. If that is all, click \"That's All\"" default answer "" buttons {"OK", "That's All", "Cancel"} default button "OK" cancel button "Cancel") 57 | set nextOption to text returned of results 58 | set buttonReturned to button returned of results 59 | if buttonReturned is "That's All" then exit repeat 60 | util's insertItemInList(nextOption, triggerOptions, listPosition) 61 | display dialog "What abbreviation do you want to use?" default answer "" 62 | set nextAbb to text returned of result 63 | util's insertItemInList(nextAbb, triggerOptionsAbb, listPosition) 64 | end repeat 65 | else 66 | 67 | -- Get the names & abbreviations of each variation (e.g. understudies) 68 | repeat while allVariations is not "Yes" 69 | set listPosition to (length of triggerOptions) + 1 70 | if length of triggerOptions is less than 1 then 71 | set results to (display dialog "Which is the first actor playing this character, or variation of the announcement?" default answer "" buttons {"OK", "That's All", "Cancel"} default button "OK" cancel button "Cancel") 72 | set nextOption to text returned of results 73 | set buttonReturned to button returned of results 74 | util's insertItemInList(nextOption, triggerOptions, listPosition) 75 | display dialog "What abbreviation do you want to use?" default answer "" 76 | set nextAbb to text returned of result 77 | util's insertItemInList(nextAbb, triggerOptionsAbb, listPosition) 78 | else 79 | set results to (display dialog "Which is the next actor playing this character, or variation of the announcement?" default answer "" buttons {"OK", "That's All", "Cancel"} default button "OK" cancel button "Cancel") 80 | set nextOption to text returned of results 81 | set buttonReturned to button returned of results 82 | if buttonReturned is "That's All" then exit repeat 83 | util's insertItemInList(nextOption, triggerOptions, listPosition) 84 | display dialog "What abbreviation do you want to use?" default answer "" 85 | set nextAbb to text returned of result 86 | util's insertItemInList(nextAbb, triggerOptionsAbb, listPosition) 87 | end if 88 | 89 | 90 | end repeat 91 | 92 | end if 93 | 94 | 95 | -- Create cue list if necessary, or switch to it 96 | try 97 | set current cue list to first cue list whose q name is "Select Playback Variants" 98 | on error 99 | make type "cue list" 100 | set variantSelectCueList to first cue list whose q name is "Cue list" 101 | set q name of variantSelectCueList to "Select Playback Variants" 102 | collapse variantSelectCueList 103 | set current cue list to first cue list whose q name is "Select Playback Variants" 104 | end try 105 | 106 | -- Make the main variations group (not to be fired, just to house those within) 107 | make type "group" 108 | set triggerGroup to last item of (selected as list) 109 | set mode of triggerGroup to timeline 110 | set q name of triggerGroup to "Select: " & triggerName 111 | set q color of triggerGroup to "cerulean" 112 | set triggerGroupID to uniqueID of triggerGroup 113 | 114 | -- Make variation groups 115 | repeat with eachItem in triggerOptions 116 | 117 | --Set the current variation for triggerOptionsAbb 118 | set currentPosition to currentPosition + 1 119 | set eachAbb to item currentPosition in triggerOptionsAbb 120 | 121 | -- Make the group for each trigger option 122 | make type "group" 123 | set itemGroup to last item of (selected as list) 124 | set mode of itemGroup to timeline 125 | set q name of itemGroup to "Select " & triggerName & ": " & eachItem 126 | set q number of itemGroup to "sel." & triggerAbb & "." & eachAbb 127 | set itemGroupID to uniqueID of itemGroup 128 | move cue id itemGroupID of parent of itemGroup to end of triggerGroup 129 | 130 | -- Disarm all 131 | make type "network" 132 | set disarmAll to last item of (selected as list) 133 | set disarmAllID to uniqueID of disarmAll 134 | set osc message type of disarmAll to qlab 135 | set q_num of disarmAll to triggerAbb & ".*" 136 | set q_command of disarmAll to 20 137 | set q_params of disarmAll to "0" 138 | move cue id disarmAllID of parent of disarmAll to end of itemGroup 139 | 140 | -- Arm correct cues 141 | make type "network" 142 | set armCorrect to last item of (selected as list) 143 | set armCorrectID to uniqueID of armCorrect 144 | set osc message type of armCorrect to qlab 145 | set q_num of armCorrect to triggerAbb & "." & eachAbb & ".*" 146 | set q_command of armCorrect to 20 147 | set q_params of armCorrect to "1" 148 | move cue id armCorrectID of parent of armCorrect to end of itemGroup 149 | 150 | -- Uncolour all 151 | make type "network" 152 | set uncolorAll to last item of (selected as list) 153 | set uncolorAllID to uniqueID of uncolorAll 154 | set osc message type of uncolorAll to qlab 155 | set q_num of uncolorAll to triggerAbb & ".*" 156 | set q_command of uncolorAll to 21 157 | set q_params of uncolorAll to "none" 158 | move cue id uncolorAllID of parent of uncolorAll to end of itemGroup 159 | 160 | -- Color currently chosen options 161 | make type "network" 162 | set colorCorrect to last item of (selected as list) 163 | set colorCorrectID to uniqueID of colorCorrect 164 | set osc message type of colorCorrect to qlab 165 | set q_num of colorCorrect to triggerAbb & "." & eachAbb & ".*" 166 | set q_command of colorCorrect to 21 167 | set q_params of colorCorrect to "celadon" 168 | move cue id colorCorrectID of parent of colorCorrect to end of itemGroup 169 | 170 | -- Rename the group which contains the voiceover / announcement, to visually display the currently selected variation 171 | set thisCuePrefix to triggerAbb & "." & eachAbb 172 | set thisCueName to eachItem 173 | set thisCueList to "cues in (first cue list whose q name is \"Main Cue List\")" 174 | my makeRenameScript(thisCuePrefix, thisCueName, thisCueList, itemGroup) 175 | 176 | collapse itemGroup 177 | 178 | end repeat 179 | 180 | end tell 181 | 182 | 183 | -- FUNCTIONS ------------------------------ 184 | 185 | -- Script with the text to be copied into the script created, for renaming groups containing these SFX 186 | on makeRenameScript(theCuePrefix, theCueName, theCueList, itemGroup) 187 | tell application id "com.figure53.Qlab.4" to tell front workspace 188 | 189 | make type "Script" 190 | set renameScript to last item of (selected as list) 191 | set renameScriptID to uniqueID of renameScript 192 | set script source of renameScript to "tell application id \"com.figure53.QLab.4\" to tell front workspace 193 | 194 | set cuePrefix to \"" & theCuePrefix & "\" 195 | set cueName to \"" & theCueName & "\" 196 | set cueList to " & theCueList & " 197 | set controlCueList to cues in (first cue list whose q name is \"Select Playback Variants\") 198 | 199 | repeat with levelOneCues in cueList 200 | if q type of levelOneCues is \"Group\" then 201 | my testForIt(cuePrefix, cueName, cueList, levelOneCues) 202 | set levelOneCuesList to cues in levelOneCues 203 | repeat with levelTwoCues in levelOneCuesList 204 | my testForIt(cuePrefix, cueName, cueList, levelTwoCues) 205 | end repeat 206 | end if 207 | end repeat 208 | 209 | -- new addition starts 210 | repeat with levelOneCues in controlCueList 211 | if q type of levelOneCues is \"Group\" then 212 | my testForIt((\"sel.\" & cuePrefix), cueName, controlCueList, levelOneCues) 213 | set levelOneCuesList to cues in levelOneCues 214 | repeat with levelTwoCues in levelOneCuesList 215 | my testForIt((\"sel.\" & cuePrefix), cueName, controlCueList, levelTwoCues) 216 | end repeat 217 | end if 218 | end repeat 219 | -- new addition ends 220 | 221 | end tell 222 | 223 | on testForIt(cuePrefix, cueName, cueList, groupCue) 224 | 225 | tell application id \"com.figure53.Qlab.4\" to tell front workspace 226 | try 227 | set eachCue to cues in groupCue 228 | set isThisCue to \"\" 229 | repeat with nextCues in eachCue 230 | if q number of nextCues starts with cuePrefix then 231 | set isThisCue to \"YES\" 232 | exit repeat 233 | else 234 | set isThisCue to \"NO\" 235 | end if 236 | end repeat 237 | --display dialog isThisCue 238 | if isThisCue is \"YES\" then 239 | if notes of groupCue is \"\" then set notes of groupCue to q name of groupCue 240 | set originalCueName to notes of groupCue 241 | set q name of groupCue to cueName & \" | \" & originalCueName 242 | end if 243 | end try 244 | end tell 245 | 246 | end testForIt" 247 | set q name of renameScript to "Rename group " & theCuePrefix 248 | move cue id renameScriptID of parent of renameScript to end of itemGroup 249 | end tell 250 | 251 | end makeRenameScript -------------------------------------------------------------------------------- /SFX Variations/Create a variant SFX from audio files.applescript: -------------------------------------------------------------------------------- 1 | -- @description SFX VARIATIONS: Create a variant SFX from audio files 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Creates a group of multiple variations of the same SFX, to be armed and disarmed by a selection cue. Uses the audio file name to name the cue 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.0 + moved common functions to external script 12 | -- v1.1 + cleaned up unnecessary functions 13 | -- v1.0 + init 14 | 15 | 16 | property util : script "Applescript Utilities" 17 | 18 | 19 | -- RUN SCRIPT ----------------------------- 20 | 21 | tell application id "com.figure53.Qlab.4" to tell front workspace 22 | 23 | -- Define variables 24 | set itemNumber to "" 25 | set otherFilesPrefix to {} 26 | 27 | -- Files should be named with the cue number and the title of the cue, then the actor's full name / full announcement title after a comma. e.g. "ann.eve.1 Opening Announcement, Evening" for an opening announcement 28 | 29 | -- Please note the script does not perform any checks to ensure all global information is correct on on the files (variable, number, name) 30 | 31 | -- Get files first. Populate arrays with all necessary details. 32 | 33 | set audioFilesOne to choose file with prompt "Please select the first audio file to insert into a variation" of type {"public.audio"} 34 | set audioFiles to choose file with prompt "Please select all other alternate versions" of type {"public.audio"} with multiple selections allowed 35 | 36 | -- Decode the name into all the relevant data 37 | 38 | -- Get variable information from the first file 39 | 40 | set firstFileName to util's getFileName(audioFilesOne) 41 | 42 | set fileOneArray to (util's splitString(firstFileName, ".")) 43 | set filePrefixOne to item 1 of fileOneArray 44 | set filePrefixTwo to item 2 of fileOneArray 45 | set fileAllThree to item 3 of fileOneArray 46 | 47 | set fileOneArrayTwo to (util's splitString(fileAllThree, " ")) 48 | set filePrefixThree to item 1 of fileOneArrayTwo 49 | set fileName to "" 50 | 51 | repeat with eachItem from 2 to (length of fileOneArrayTwo) 52 | set fileName to fileName & " " & (item eachItem of fileOneArrayTwo) 53 | end repeat 54 | 55 | set fileOneArrayThree to (util's splitString(fileName, ", ")) 56 | set fileName to item 1 of fileOneArrayThree 57 | 58 | -- Get variant information from all subsequent files 59 | repeat with eachFile in audioFiles 60 | set eachFileName to (util's getFileName(eachFile)) 61 | set eachFileArray to (util's splitString(eachFileName, ".")) 62 | set eachFilePrefixOne to item 1 of eachFileArray 63 | set eachFilePrefixTwo to item 2 of eachFileArray 64 | set eachFileAllThree to item 3 of eachFileArray 65 | 66 | set eachFileArrayTwo to (util's splitString(eachFileAllThree, " ")) 67 | set eachFilePrefixThree to item 1 of eachFileArrayTwo 68 | set eachFileName to "" 69 | 70 | repeat with eachItem from 2 to (length of eachFileArrayTwo) 71 | set eachFileName to eachFileName & " " & (item eachItem of eachFileArrayTwo) 72 | end repeat 73 | 74 | set eachFileArrayThree to (util's splitString(eachFileName, ", ")) 75 | set eachFileName to item 1 of eachFileArrayThree 76 | set end of otherFilesPrefix to eachFilePrefixTwo 77 | 78 | -- Check information against the first file 79 | if eachFilePrefixOne is not equal to filePrefixOne then display dialog "The variable ABBREVIATION for \"" & eachFilePrefixOne & "." & eachFilePrefixTwo & "." & eachFilePrefixThree & " " & eachFileName & "\" is not the same as that in the first file. Would you like to continue? If you do, the abbreviation from the first file will be used" default button "OK" cancel button "Cancel" with title "Abbreviation Inconsistency" 80 | 81 | if eachFilePrefixThree is not equal to filePrefixThree then display dialog "The variation NUMBER for \"" & eachFilePrefixOne & "." & eachFilePrefixTwo & "." & eachFilePrefixThree & " " & eachFileName & "\" is not the same as that in the first file. Would you like to continue? If you do, the number from the first file will be used" default button "OK" cancel button "Cancel" with title "Variation Number Inconsistency" 82 | 83 | if eachFileName is not equal to fileName then display dialog "The cue NAME for \"" & eachFilePrefixOne & "." & eachFilePrefixTwo & "." & eachFilePrefixThree & " " & eachFileName & "\" is not the same as that in the first file. Would you like to continue? If you do, the name from the first file will be used" default button "OK" cancel button "Cancel" with title "Variation Name Inconsistency" 84 | 85 | 86 | end repeat 87 | 88 | 89 | -- For debugging, the following snippet can be re-enabled. It will display to you the prefix information, and all additional variants, in a dialog, followed by the cue name 90 | 91 | (* 92 | set allVariants to "" 93 | if (get count of otherFilesPrefix) is greater than 0 then 94 | repeat with theItem in otherFilesPrefix 95 | set allVariants to allVariants & " : " & theItem 96 | end repeat 97 | end if 98 | 99 | 100 | 101 | display dialog filePrefixOne & "/" & filePrefixTwo & "/" & filePrefixThree & " Other Variants" & allVariants with title "Please check these details" 102 | display dialog fileName with title "Please check these details: Cue Name" 103 | *) 104 | 105 | -- Get actor names 106 | set actorNameArray to {} 107 | set actorNameOne to item 2 of (util's splitString(firstFileName, ", ")) 108 | set actorNameOneFinal to item 1 of (util's splitString(actorNameOne, ".")) 109 | set end of actorNameArray to actorNameOneFinal 110 | repeat with eachFile in audioFiles 111 | set eachFileName to (util's getFileName(eachFile)) 112 | set eachFileNameArray to (util's splitString(eachFileName, ", ")) 113 | set nextActorName to item 2 of eachFileNameArray 114 | set nextActorNameFinal to item 1 of (util's splitString(nextActorName, ".")) 115 | set end of actorNameArray to nextActorNameFinal 116 | end repeat 117 | 118 | -- Create the main group 119 | make type "Group" 120 | set mainSFXGroup to last item of (selected as list) 121 | set mode of mainSFXGroup to timeline 122 | set mainSFXGroupID to uniqueID of mainSFXGroup 123 | set q name of mainSFXGroup to fileName 124 | set q color of mainSFXGroup to "Blue" 125 | 126 | -- Create first audio cue 127 | make type "Audio" 128 | set audioOne to last item of (selected as list) 129 | set audioOneID to uniqueID of audioOne 130 | set q name of audioOne to ((item 1 of actorNameArray) & " | " & fileName) as string 131 | set q number of audioOne to filePrefixOne & "." & filePrefixTwo & "." & filePrefixThree 132 | set file target of audioOne to audioFilesOne 133 | move cue id audioOneID of parent of audioOne to end of mainSFXGroup 134 | 135 | -- Create subsequent audio cues 136 | set itemNumber to 0 137 | repeat with eachFile in audioFiles 138 | set itemNumber to itemNumber + 1 139 | make type "Audio" 140 | set nextAudio to last item of (selected as list) 141 | set nextAudioID to uniqueID of nextAudio 142 | set q name of nextAudio to ((item (itemNumber + 1) of actorNameArray) & " | " & fileName as string) 143 | set q number of nextAudio to filePrefixOne & "." & (item itemNumber of otherFilesPrefix) & "." & filePrefixThree 144 | set file target of nextAudio to eachFile 145 | move cue id nextAudioID of parent of nextAudio to end of mainSFXGroup 146 | end repeat 147 | 148 | 149 | end tell -------------------------------------------------------------------------------- /SFX Variations/Create link to select playback variants in rig check.applescript: -------------------------------------------------------------------------------- 1 | -- @description SFX VARIATIONS: Create link to select playback variants in rig check 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.0 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Creates a cue underneath the rig check marker to go to any selection cues and choose the variant for the next performance 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.0 + moved common functions to external script 12 | -- v1.1 + allows assignment of UDVs from the script calling this one 13 | 14 | 15 | -- USER DEFINED VARIABLES ----------------- 16 | 17 | try -- if global variables are given when this script is called by another, use those variables 18 | whereIsRigCheck 19 | on error 20 | set whereIsRigCheck to " RIG CHECK" -- the cue name of your rig check title cue – the cue this script creates will go underneath this 21 | end try 22 | 23 | ---------- END OF USER DEFINED VARIABLES -- 24 | 25 | 26 | property util : script "Applescript Utilities" 27 | 28 | 29 | -- RUN SCRIPT ----------------------------- 30 | 31 | tell application id "com.figure53.Qlab.4" to tell front workspace 32 | 33 | -- Define variables 34 | set allVariants to "" 35 | set current cue list to first cue list whose q name is "Main Cue List" 36 | set theCueList to cues in first cue list whose q name is "Select Playback Variants" 37 | set cueBefore to (first cue in current cue list whose q name is whereIsRigCheck) 38 | 39 | -- Get a list of all variables 40 | repeat with eachCue in (cues in (first cue list whose q name is "Select Playback Variants") as list) 41 | if allVariants is "" then 42 | set allVariants to item 2 of (util's splitString((q name of eachCue), ": ")) 43 | else 44 | set allVariants to allVariants & ", " & item 2 of (util's splitString((q name of eachCue), ": ")) 45 | end if 46 | end repeat 47 | 48 | -- Create the cue 49 | set selected to cueBefore 50 | make type "Script" 51 | set scriptCheckCue to last item of (selected as list) 52 | set scriptCheckCueID to uniqueID of scriptCheckCue 53 | set q name of scriptCheckCue to " Set playback variants here: " & allVariants 54 | set script source of scriptCheckCue to "tell application id \"com.figure53.Qlab.4\" to tell front workspace 55 | 56 | set current cue list to first cue list whose q name is \"Select Playback Variants\" 57 | 58 | end tell" 59 | 60 | end tell -------------------------------------------------------------------------------- /Soundcheck/Create Spoken Line Check Cues.applescript: -------------------------------------------------------------------------------- 1 | -- @description Create spoken line check cues 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.2 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Creates spoken output names and automated line check cues 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.2 + bug fix for gang-fix in 2.1 12 | -- v2.1 + now works if your template audio cue includes ganged channels 13 | -- v2.0 + moved common functions to external script 14 | -- v1.5 + allows assignment of UDVs from the script calling this one 15 | -- v1.4 + takes channel list and level information from the notes of cues, to streamline editing for new projects 16 | -- v1.3 + creates cues in the correct order 17 | -- + cleaned up "speak output names" loop 18 | -- + recompiling or running the script within qlab no longer throws an error 19 | 20 | 21 | -- USER DEFINED VARIABLES ----------------- 22 | 23 | -- Locate the cue list containing Script Variables 24 | try -- if global variables are given when this script is called by another, use those variables 25 | variableCueListName 26 | on error 27 | set variableCueListName to "Other scripts & utilities" 28 | end try 29 | 30 | -- Set file type to save (wav or aiff) 31 | try 32 | fileType 33 | on error 34 | set fileType to ".wav" 35 | end try 36 | 37 | -- Set the cue which you want to precede your line check group 38 | try 39 | rigCheckTitleCue 40 | on error 41 | set rigCheckTitleCue to " RIG CHECK" -- Leave blank to use the current position 42 | end try 43 | 44 | -- Set the cue list you want to place this group cue in 45 | try 46 | mainCueListName 47 | on error 48 | set mainCueListName to "Main Cue list" 49 | end try 50 | 51 | -- Set the name of the sub sound. This should be saved, relative to the Qlab file, in "~/Soundcheck/Line Checks" 52 | try 53 | subFileName 54 | on error 55 | set subFileName to "Sub v2.wav" 56 | end try 57 | 58 | -- Set the delay between each file playing in seconds 59 | try 60 | userDelay 61 | on error 62 | set userDelay to 0.5 63 | end try 64 | 65 | ---------- END OF USER DEFINED VARIABLES -- 66 | 67 | 68 | -- VARIABLES FROM QLAB NOTES -------------- 69 | 70 | -- Input channel names as a single string, separated by ", ". 71 | -- Some guidance on channel names for the best result: 72 | -- 1. for main PA, using the term "pros" will have its pronunciation corrected. 73 | -- 2. for foldback, the TTS works better if "Foldback" is not the first word. Try putting the side before, rather than after, "Foldback". If there is only 1 foldback channel, try "Stage Foldback" 74 | -- 3. for subs, include the word "Sub" in each channel's name. This will use the sub soundcheck sound instead of a spoken voice. 75 | 76 | tell application id "com.figure53.Qlab.4" to tell front workspace 77 | set userChannels to notes of (first cue of (first cue list whose q name is variableCueListName) whose q name is "Output channel names") 78 | end tell 79 | 80 | -- Set the level which the audio files will play back at in Qlab. Sub is separate since it is a separate sound. 81 | tell application id "com.figure53.Qlab.4" to tell front workspace 82 | set userLevel to notes of (first cue of (first cue list whose q name is variableCueListName) whose q name is "Line checks: output level") 83 | set subLevel to notes of (first cue of (first cue list whose q name is variableCueListName) whose q name is "Line checks: sub level") 84 | end tell 85 | 86 | ------------------ END OF QLAB VARIABLES -- 87 | 88 | 89 | property util : script "Applescript Utilities" 90 | 91 | 92 | ---- RUN SCRIPT --------------------------- 93 | 94 | -- Get the path to the project 95 | tell application id "com.figure53.Qlab.4" to tell front workspace 96 | set qlabPath to path 97 | end tell 98 | 99 | tell application "Finder" 100 | set qlabPathAlias to POSIX file qlabPath as alias 101 | set qlabParentPath to (container of qlabPathAlias) as alias 102 | end tell 103 | 104 | set saveLocation to (POSIX path of qlabParentPath & "Soundcheck/Line Checks/") 105 | 106 | -- Set current cue list to the Main Cue List. 107 | tell application id "com.figure53.Qlab.4" to tell front workspace 108 | set current cue list to first cue list whose q name is mainCueListName 109 | end tell 110 | 111 | 112 | -- If the cues already exist, delete them before running the rest of this script: 113 | checkForCues() 114 | 115 | 116 | -- If the audio files already exist, delete them before running the rest of this script: 117 | checkForFiles(saveLocation, subFileName) 118 | 119 | 120 | -- Convert userChannels into a list 121 | set theChannels to util's splitString(userChannels, ", ") 122 | 123 | -- Speak output names 124 | set outputCount to count of theChannels 125 | 126 | repeat with eachOutput from 1 to outputCount 127 | set eachOutputToSay to correctOutputName(item eachOutput of theChannels) 128 | if eachOutputToSay does not contain "Sub" then 129 | say (eachOutputToSay) using "Daniel" saving to (POSIX file saveLocation & checkDigits(eachOutput, 2) & " " & (item eachOutput of theChannels) as string) & fileType 130 | else 131 | set newFileName to (checkDigits(eachOutput, 2) & " " & (item eachOutput of theChannels) as string) & fileType 132 | tell application "Finder" 133 | set newFile to duplicate file (POSIX file (saveLocation & subFileName) as alias) 134 | set name of newFile to newFileName 135 | end tell 136 | end if 137 | end repeat 138 | 139 | 140 | ---- Import into Qlab 141 | 142 | -- Make main cue list a variable 143 | tell application id "com.figure53.Qlab.4" to tell front workspace 144 | set mainCueList to (first cue list whose q name is mainCueListName) 145 | 146 | -- Get rig check title cue, so it knows where to make these cues 147 | if rigCheckTitleCue is not "" then 148 | set current cue list to mainCueList 149 | set titleCue to (first cue whose q name is rigCheckTitleCue) 150 | set playback position of mainCueList to titleCue 151 | end if 152 | 153 | -- Make the group 154 | make type "Group" 155 | set groupCue to last item of (selected as list) 156 | set q name of groupCue to "Line Check" 157 | set mode of groupCue to timeline 158 | end tell 159 | 160 | -- Get all files in the linecheck folder 161 | tell application "Finder" 162 | set saveLocationAlias to POSIX file saveLocation as alias 163 | delay 1 164 | set allTheFiles to (entire contents of folder saveLocationAlias) 165 | end tell 166 | 167 | -- Make audio cues 168 | tell application id "com.figure53.Qlab.4" to tell front workspace 169 | repeat with eachOutput in util's sortList(allTheFiles) 170 | if q number of eachOutput is not subFileName then 171 | set eachOutputName to my getOutputName(eachOutput) 172 | set eachOutputNumber to my getOutputNumber(eachOutput) 173 | make type "Audio" -- make cue 174 | set thisCue to last item of (selected as list) -- give the cue a variable 175 | set file target of thisCue to eachOutput as alias -- add the file to the cue 176 | set q name of thisCue to eachOutputName 177 | 178 | -- Put the cue into the group cue 179 | set thisCueID to uniqueID of thisCue 180 | try 181 | move cue id thisCueID of parent of thisCue to end of groupCue 182 | end try 183 | 184 | -- Set level of cues as they are made 185 | repeat with eachColumn from 1 to outputCount 186 | if eachColumn is eachOutputNumber then 187 | set eachGang to getGang thisCue row 0 column eachColumn 188 | if item eachOutputNumber of theChannels contains "Sub" then 189 | if eachGang is missing value then 190 | setLevel thisCue row 0 column eachColumn db subLevel 191 | setLevel thisCue row 1 column eachColumn db 0 192 | else 193 | setGang thisCue row 0 column eachColumn gang "" 194 | setLevel thisCue row 0 column eachColumn db subLevel 195 | setLevel thisCue row 1 column eachColumn db 0 196 | setGang thisCue row 0 column eachColumn gang eachGang 197 | end if 198 | else 199 | if eachGang is missing value then 200 | setLevel thisCue row 0 column eachColumn db userLevel 201 | setLevel thisCue row 1 column eachColumn db 0 202 | else 203 | setGang thisCue row 0 column eachColumn gang "" 204 | setLevel thisCue row 0 column eachColumn db userLevel 205 | setLevel thisCue row 1 column eachColumn db 0 206 | setGang thisCue row 0 column eachColumn gang eachGang 207 | end if 208 | end if 209 | else 210 | setLevel thisCue row 0 column eachColumn db "-inf" 211 | end if 212 | end repeat 213 | 214 | -- Set predelay of cues as they are made 215 | set previousCue to cue before thisCue 216 | if eachOutputNumber is not 1 then 217 | set previousDuration to duration of previousCue 218 | set previousPreWait to pre wait of previousCue 219 | set pre wait of thisCue to (previousDuration + previousPreWait + userDelay) 220 | end if 221 | end if 222 | end repeat 223 | 224 | -- Brief delay to let the user see the completed cue stack 225 | delay 0.5 226 | collapse groupCue 227 | 228 | end tell 229 | 230 | 231 | -- FUNCTIONS ------------------------------ 232 | 233 | on checkDigits(num, howLong) 234 | set num to text -howLong thru -1 of ("00" & num) 235 | return num 236 | end checkDigits 237 | 238 | on correctOutputName(outputName) 239 | if outputName contains "Pros" then 240 | set newOutputName to util's findAndReplaceInText(outputName, "Pros", "Proz") 241 | return newOutputName 242 | else 243 | return outputName 244 | end if 245 | 246 | end correctOutputName 247 | 248 | -- Checks for cues and deletes them if they're already present 249 | 250 | on checkForCues() 251 | tell application id "com.figure53.Qlab.4" to tell front workspace 252 | set groupCueAlready to "" 253 | try 254 | set groupCueAlready to (first cue whose q name is "Line Check") 255 | set groupCueAlreadyID to uniqueID of groupCueAlready 256 | end try 257 | 258 | if groupCueAlready is not "" then 259 | delete cue id groupCueAlreadyID of parent of groupCueAlready -- of cue list mainCueList 260 | end if 261 | end tell 262 | end checkForCues 263 | 264 | -- Checks for audio files and deletes them if they're already present 265 | 266 | on checkForFiles(saveLocation, subFileName) 267 | tell application "Finder" 268 | set saveLocationAlias to POSIX file saveLocation as alias 269 | set startingFolderContents to (entire contents of folder saveLocationAlias) 270 | if (count of startingFolderContents) is not 1 then 271 | repeat with eachItem in startingFolderContents 272 | if name of eachItem is not (subFileName) then 273 | delete eachItem 274 | end if 275 | end repeat 276 | end if 277 | end tell 278 | end checkForFiles 279 | 280 | -- Gets the output name from the file name. Hopefully useful if the list is not in the correct order. 281 | 282 | on getOutputName(theFile) 283 | tell application "Finder" 284 | set fileName to name of theFile 285 | end tell 286 | set nameWithoutExtension to util's splitString(fileName, ".") 287 | set nameAsList to util's splitString(item 1 of nameWithoutExtension, "") 288 | set outputList to items 4 thru -1 of nameAsList as string 289 | return outputList 290 | end getOutputName 291 | 292 | -- Gets the output number from the file name. Similarly (hopefully) useful if the list is not in the correct order. 293 | 294 | on getOutputNumber(theFile) 295 | tell application "Finder" 296 | set fileName to name of theFile 297 | end tell 298 | set nameAsList to util's splitString(items 1 thru 2 of fileName, "") 299 | set outputNumber to item 1 of nameAsList & item 2 of nameAsList as number 300 | return outputNumber 301 | end getOutputNumber -------------------------------------------------------------------------------- /Soundcheck/Line Check Audio Files/Sub v1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsmith96/Qlab-Scripts/51af4a8548fdf383cac9c33a1157110a07d802dc/Soundcheck/Line Check Audio Files/Sub v1.wav -------------------------------------------------------------------------------- /Soundcheck/Line Check Audio Files/Sub v2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsmith96/Qlab-Scripts/51af4a8548fdf383cac9c33a1157110a07d802dc/Soundcheck/Line Check Audio Files/Sub v2.wav -------------------------------------------------------------------------------- /Soundcheck/Speaker Polarity Check.applescript: -------------------------------------------------------------------------------- 1 | -- @description Speaker Polarity Check 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Designed to work with the android app "Polarity Checker", with audio files stored in a hidden cue list. This script launches audio files. 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.0 + init 12 | 13 | 14 | -- RUN SCRIPT ----------------------------- 15 | 16 | -- If there is no audio, check the routing of the audio files (in "Other Scripts") 17 | 18 | tell application id "com.figure53.Qlab.4" to tell front workspace 19 | 20 | set playbackOptions to {"STOP", "Full Range", "80 Hz", "160 Hz", "500 Hz", "1k2 Hz", "4 kHz"} 21 | 22 | set polarityCheck to choose from list playbackOptions with title "Sample Selection" with prompt "Select the sample to play" 23 | if polarityCheck is {"STOP"} then 24 | if cue "SPC" is running then 25 | stop cue "SPC" 26 | return 27 | else 28 | return 29 | end if 30 | else if polarityCheck is false then 31 | return 32 | end if 33 | 34 | display dialog "Invert signal?" buttons {"Yes", "No"} default button "No" 35 | set invertCheck to button returned of result 36 | 37 | if polarityCheck is {"Full Range"} then set cueNum to "All" 38 | if polarityCheck is {"80 Hz"} then set cueNum to "80" 39 | if polarityCheck is {"160 Hz"} then set cueNum to "160" 40 | if polarityCheck is {"500 Hz"} then set cueNum to "500" 41 | if polarityCheck is {"1k2 Hz"} then set cueNum to "1k2" 42 | if polarityCheck is {"4 Khz"} then set cueNum to "4k" 43 | 44 | if invertCheck is "Yes" then set cuePrefix to "i" 45 | if invertCheck is "No" then set cuePrefix to "n" 46 | 47 | set fullCueNumber to cuePrefix & cueNum as string 48 | 49 | if cue "SPC" is running then 50 | if cue fullCueNumber is running then 51 | stop cue "SPC" 52 | else 53 | stop cue "SPC" 54 | delay 0.1 55 | start cue fullCueNumber 56 | end if 57 | else 58 | start cue fullCueNumber 59 | end if 60 | 61 | 62 | end tell -------------------------------------------------------------------------------- /Tech Rehearsals/Locate to Reaper Marker.applescript: -------------------------------------------------------------------------------- 1 | -- @description Locate to Reaper Marker 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.2 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Sends an OSC message to Reaper (running a multitrack of the show) to recall the marker with the same cue number as the current selection. Use in conjunction with https://github.com/bsmith96/Reaper-Scripts/blob/master/Markers/Locate%20to%20marker.lua in Reaper 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.2 + osc cue number is now a variable 12 | -- v1.1 + added user defined variable for reaper's OSC command 13 | 14 | 15 | -- USER DEFINED VARIABLES ----------------- 16 | 17 | try -- if global variables are given when this script is called by another, use those variables 18 | reaperOscCommand 19 | on error 20 | set reaperOscCommand to "/reaper/marker_cue" 21 | end try 22 | 23 | try 24 | oscCueNumber 25 | on error 26 | set oscCueNumber to "LocateReaper" 27 | end try 28 | 29 | ---------- END OF USER DEFINED VARIABLES -- 30 | 31 | 32 | tell application id "com.figure53.Qlab.4" to tell front workspace 33 | 34 | -- Get currently selected cue 35 | set cueNumberString to q number of (last item of (selected as list)) 36 | 37 | -- Convert string cue number into integer (Reaper only accepts Integers as Marker IDs) 38 | try 39 | set cueNumber to cueNumberString as integer 40 | on error 41 | display dialog "Cue number is not an integer" giving up after 2 42 | return 43 | end try 44 | 45 | -- Put the cue number between 0 and 1 (999 available – ReaScript can only interpret values sent by OSC if they are floating point) 46 | set cueNumber to cueNumber / 1000 47 | 48 | -- Assign the OSC cue which sends this command to a variable 49 | set oscCue to cue oscCueNumber 50 | 51 | -- Set the message of the OSC cue and send this message 52 | set custom message of oscCue to reaperOscCommand & " " & (cueNumber as string) 53 | preview oscCue 54 | 55 | end tell 56 | -------------------------------------------------------------------------------- /Tech Rehearsals/Move to cut list.applescript: -------------------------------------------------------------------------------- 1 | -- @description Move to cut list 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @source Sam Schloegel (adapted) 5 | -- @version 2.3 6 | -- @testedmacos 10.14.6 7 | -- @testedqlab 4.6.10 8 | -- @about Moves the selected cues to a cut cue list, and removes their cue number 9 | -- @separateprocess TRUE 10 | 11 | -- @changelog 12 | -- v2.3 + allows assignment of UDVs from the script calling this one 13 | -- v2.2 + successfully cuts cues without a cue number again 14 | -- v2.1 + does not allow valid numbers to remain in the cut list 15 | -- v2.0 + creates cue list if needed, renumbered 16 | 17 | 18 | -- USER DEFINED VARIABLES ----------------- 19 | 20 | try -- if global variables are given when this script is called by another, use those variables 21 | cutListName 22 | on error 23 | set cutListName to "Cut Cues" 24 | end try 25 | 26 | ---------- END OF USER DEFINED VARIABLES -- 27 | 28 | 29 | -- RUN SCRIPT ----------------------------- 30 | 31 | tell application id "com.figure53.Qlab.4" to tell front workspace 32 | 33 | set theSelection to (selected as list) 34 | 35 | -- Create cue list if necessary, or switch to it 36 | try 37 | set cutList to first cue list whose q name is cutListName 38 | on error 39 | make type "cue list" 40 | set cutList to first cue list whose q name is "Cue list" 41 | set q name of cutList to cutListName 42 | set q color of cutList to "scarlet" 43 | collapse cutList 44 | end try 45 | 46 | repeat with eachCue in theSelection 47 | if q number of eachCue is not "" then 48 | set originalCueNumber to q number of eachCue 49 | set q name of eachCue to ("(" & q number of eachCue & ") " & q list name of eachCue) 50 | set q number of eachCue to "x" & originalCueNumber 51 | end if 52 | 53 | try 54 | if q number of eachCue is originalCueNumber then -- if duplicate numbers are cut, avoids leaving those numbers valid 55 | set q number of eachCue to "" 56 | end if 57 | end try 58 | 59 | set cueID to uniqueID of eachCue 60 | set midi trigger of eachCue to disabled 61 | set hotkey trigger of eachCue to disabled 62 | set timecode trigger of eachCue to disabled 63 | set wall clock trigger of eachCue to disabled 64 | set armed of eachCue to false 65 | if parent list of eachCue is not cutList then 66 | move cue id cueID of parent of eachCue to end of cutList 67 | end if 68 | end repeat 69 | end tell -------------------------------------------------------------------------------- /Tech Rehearsals/Preset To Before Next Cue.applescript: -------------------------------------------------------------------------------- 1 | -- @description Preset to before next cue 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 2.2 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Starts all looping audio that has not been stopped before the currently selected cue 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v2.2 + allows assignment of UDVs from the script calling this one 12 | -- v2.1 + cue list name is a variable 13 | -- + removed unnecessary function 14 | -- v2.0 + changed approach to avoid starting every single cue 15 | -- v1.0 + init 16 | 17 | 18 | -- USER DEFINED VARIABLES ----------------- 19 | 20 | try -- if global variables are given when this script is called by another, use those variables 21 | cueListName 22 | on error 23 | set cueListName to "Main Cue List" 24 | end try 25 | 26 | ---------- END OF USER DEFINED VARIABLES -- 27 | 28 | 29 | -- RUN SCRIPT ----------------------------- 30 | 31 | -- Define lists to add cues to 32 | set loopCues to {} -- adds cues that infinite loop, and removes them as they stop 33 | set fadeCues to {} -- adds cues that fade levels of loopCues, but do not stop them 34 | set groupLoops to {} -- adds group cues that contain loopCues (used within handler) 35 | 36 | tell application id "com.figure53.Qlab.4" to tell front workspace 37 | set theCue to playback position of (first cue list whose q name is cueListName) 38 | set theCueID to uniqueID of theCue 39 | set allCues to every cue of (first cue list whose q name is cueListName) 40 | 41 | -- Get a list of all infinite looped audio files that haven't stopped by the current position 42 | set {loopCues, fadeCues} to my checkForCues(allCues, loopCues, fadeCues, groupLoops, theCueID, cueListName) 43 | 44 | -- Start all infinite loop cues at their loop 45 | repeat with eachCue in loopCues 46 | try 47 | set eachCue to cue id eachCue 48 | set cuePreWait to pre wait of eachCue 49 | set cueDuration to duration of eachCue 50 | set cuePostWait to post wait of eachCue 51 | load eachCue time (cuePreWait + cueDuration + cuePostWait) 52 | start eachCue 53 | end try 54 | end repeat 55 | 56 | -- Start all fades of of infinite loop cues at the end of their duration, setting the final level of fade ins or builds/dips 57 | repeat with eachCue in fadeCues 58 | try 59 | set eachCue to cue id eachCue 60 | set cuePreWait to pre wait of eachCue 61 | set cueDuration to duration of eachCue 62 | set cuePostWait to post wait of eachCue 63 | load eachCue time (cuePreWait + cueDuration + cuePostWait) 64 | start eachCue 65 | end try 66 | end repeat 67 | end tell 68 | 69 | 70 | -- FUNCTIONS ------------------------------ 71 | 72 | on checkForCues(theCues, loopCues, fadeCues, groupLoops, theCueID, cueListName) 73 | tell application id "com.figure53.Qlab.4" to tell front workspace 74 | repeat with eachCue in theCues 75 | set eachCueID to uniqueID of eachCue 76 | 77 | -- Stop the script once you reach the playhead 78 | 79 | if eachCueID is theCueID then exit repeat 80 | set eachCueType to q type of eachCue 81 | 82 | -- If the current cue is an audio cue, check it for infinite loop and add it to the list 83 | 84 | if eachCueType is "Audio" then 85 | if my checkForLoop(eachCue) is true then 86 | --my insertItemInList(uniqueID of eachCue, loopCues, 1) 87 | set end of loopCues to (uniqueID of eachCue) 88 | set parentCue to parent of eachCue 89 | repeat while parent of parentCue is not (first cue list whose q name is cueListName) 90 | --my insertItemInList((uniqueID of parent of eachCue), groupLoops, 1) 91 | set end of groupLoops to (uniqueID of parent of eachCue) 92 | set parentCue to parent of parentCue 93 | end repeat 94 | end if 95 | 96 | -- If the current cue is a stop cue, check if it targets any looping cues. If it does, remove the looping cue from the list. 97 | 98 | else if eachCueType is "Stop" then 99 | set eachCueTarget to (uniqueID of cue target of eachCue) 100 | set eachLoopPosition to 1 101 | repeat with eachLoop in loopCues 102 | if eachCueTarget is in eachLoop then 103 | set item eachLoopPosition of loopCues to "" 104 | end if 105 | repeat with eachGroup in groupLoops 106 | if eachCueTarget is in groupLoops then 107 | set item eachLoopPosition of loopCues to "" 108 | end if 109 | end repeat 110 | set eachLoopPosition to eachLoopPosition + 1 111 | end repeat 112 | 113 | -- If the current cue is a fade cue, check if it targets any looping cues. 114 | 115 | else if eachCueType is "Fade" then 116 | 117 | -- If the current cue stops a looping cue, remove that looping cue from the list. 118 | 119 | if stop target when done of eachCue is true then 120 | set eachCueTarget to (uniqueID of cue target of eachCue) 121 | set eachLoopPosition to 1 122 | repeat with eachLoop in loopCues 123 | if eachCueTarget is in eachLoop then 124 | set item eachLoopPosition of loopCues to "" 125 | end if 126 | repeat with eachGroup in groupLoops 127 | if eachCueTarget is in groupLoops then 128 | set item eachLoopPosition of loopCues to "" 129 | end if 130 | end repeat 131 | set eachLoopPosition to eachLoopPosition + 1 132 | end repeat 133 | 134 | -- If the current cue targets a looping cue but does not stop it, add it to the fadeCues list. 135 | 136 | else if stop target when done of eachCue is false then 137 | set eachCueTarget to (uniqueID of cue target of eachCue) 138 | repeat with eachLoop in loopCues 139 | if eachCueTarget is in eachLoop then 140 | --my insertItemInList(uniqueID of eachCue, fadeCues, 1) 141 | set end of fadeCues to (uniqueID of eachCue) 142 | end if 143 | end repeat 144 | end if 145 | 146 | -- If the current cue is a group cue, do this handler again (recursive) to look for looping audio cues. 147 | 148 | else if eachCueType is "Group" then 149 | my checkForCues((every cue of eachCue), loopCues, fadeCues, groupLoops, theCueID, cueListName) 150 | end if 151 | end repeat 152 | end tell 153 | return {loopCues, fadeCues} 154 | end checkForCues 155 | 156 | 157 | on checkForLoop(theCue) -- returns true or false 158 | tell application id "com.figure53.Qlab.4" to tell front workspace 159 | set theCueType to q type of theCue 160 | if theCueType is "Audio" then 161 | set theCueLoop to (infinite loop of theCue) 162 | log q name of theCue & " - " & theCueLoop 163 | return theCueLoop 164 | end if 165 | end tell 166 | end checkForLoop -------------------------------------------------------------------------------- /Tech Rehearsals/Preset desk to before next cue.applescript: -------------------------------------------------------------------------------- 1 | -- @description Preset desk to before next cue 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.2 5 | -- @testedmacos 10.14.6 6 | -- @testedqlab 4.6.10 7 | -- @about Recalls the most recently recalled scene, if scene recalls have been generated with these scripts 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.2 + allows assignment of UDVs from the script calling this one 12 | -- v1.1 + now works correctly when the playhead does not contain a desk cue 13 | 14 | 15 | -- USER DEFINED VARIABLES ----------------- 16 | 17 | try -- if global variables are given when this script is called by another, use those variables 18 | cueListName 19 | on error 20 | set cueListName to "Main Cue List" 21 | end try 22 | 23 | try 24 | howManyToRecall 25 | on error 26 | set howManyToRecall to 1 -- To load several scenes quickly, e.g. if you are using recall filters and want to load the last 5 to ensure you have the correct settings running into the next scene. 27 | end try 28 | 29 | try 30 | recallDelay 31 | on error 32 | set recallDelay to 0.5 -- Delay in seconds between recalls, when howManyToRecall is greater than 1 33 | end try 34 | 35 | ---------- END OF USER DEFINED VARIABLES -- 36 | 37 | 38 | -- RUN SCRIPT ----------------------------- 39 | 40 | -- Define lists to add cues to 41 | set allCuesBeforePlayhead to {} 42 | set sceneRecallCues to {} 43 | set allSceneRecallCues to {} 44 | set cueListMidiCues to {} 45 | set howManyToRecallList to {} 46 | 47 | tell application id "com.figure53.Qlab.4" to tell front workspace 48 | set theCue to playback position of (first cue list whose q name is cueListName) 49 | set theCueID to uniqueID of theCue 50 | set allCues to every cue of (first cue list whose q name is cueListName) 51 | 52 | -- Get a list of all top-level cues before the playhead 53 | repeat with eachCue in allCues 54 | if uniqueID of eachCue is theCueID then 55 | exit repeat 56 | end if 57 | set end of allCuesBeforePlayhead to uniqueID of eachCue 58 | end repeat 59 | 60 | -- Get all midi cues in main cue list 61 | set allMidiCues to every cue whose q type is "Midi" 62 | repeat with eachCue in allMidiCues 63 | if parent list of eachCue is (first cue list whose q name is cueListName) then set end of cueListMidiCues to eachCue 64 | end repeat 65 | 66 | -- Get all scene recall cues (based on current naming scheme of desk midi cues) 67 | repeat with eachCue in cueListMidiCues 68 | if q name of eachCue starts with "Scene " and q name of eachCue ends with "change" then set end of allSceneRecallCues to eachCue 69 | end repeat 70 | 71 | -- Get main group containing all scene recall cues 72 | repeat with eachCue in allSceneRecallCues 73 | set eachParent to parent of eachCue 74 | 75 | -- Find the main group 76 | repeat 77 | if parent of eachCue is (first cue list whose q name is cueListName) then 78 | set eachParentID to uniqueID of eachCue 79 | exit repeat 80 | else if parent of eachParent is (first cue list whose q name is cueListName) then 81 | set eachParentID to uniqueID of eachParent 82 | exit repeat 83 | else 84 | set eachParent to parent of eachParent 85 | end if 86 | end repeat 87 | 88 | -- Put cues into new group until you reach the current selection 89 | 90 | if eachParentID is in allCuesBeforePlayhead then 91 | set end of sceneRecallCues to eachCue 92 | end if 93 | end repeat 94 | 95 | -- Recall most recent scene recall cue 96 | 97 | if howManyToRecall is 1 then 98 | set cueToGo to q name of (item -1 of sceneRecallCues) 99 | log cueToGo 100 | start (item -1 of sceneRecallCues) 101 | 102 | -- Recall as many cues before the most recent as specified, with the specified delay between recalls 103 | else if howManyToRecall is greater than 1 then 104 | repeat with i from 1 to howManyToRecall 105 | set end of howManyToRecallList to i 106 | end repeat 107 | repeat with i in reverse of howManyToRecallList -- Reverse to recall cues in the correct order 108 | try 109 | set allCuesCount to count of sceneRecallCues 110 | set cueToGo to q name of (item -i of sceneRecallCues) 111 | log cueToGo 112 | start (item -i of sceneRecallCues) 113 | delay recallDelay 114 | end try 115 | end repeat 116 | end if 117 | 118 | end tell -------------------------------------------------------------------------------- /Tech Rehearsals/Select cues that loop infinitely.applescript: -------------------------------------------------------------------------------- 1 | -- @description Select cues that loop infinitely 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Of the selection, leaves only cues selected which have infinite loop set to true 8 | -- separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.0 + init 12 | 13 | 14 | tell application id "com.figure53.Qlab.4" to tell front workspace 15 | set theSelection to (selected as list) 16 | set theList to {} 17 | 18 | repeat with eachCue in theSelection 19 | if q type of eachCue is "Audio" and infinite loop of eachCue is true then 20 | set end of theList to eachCue 21 | end if 22 | set selected to theList 23 | end repeat 24 | 25 | display notification ((length of theList as string) & " of " & (length of theSelection as string) & " cues were found and selected") with title "Infinite loop" 26 | end tell -------------------------------------------------------------------------------- /Tech Rehearsals/Start the loop of selected cue.applescript: -------------------------------------------------------------------------------- 1 | -- @description Start the loop of selected cue 2 | -- @author Ben Smith 3 | -- @link bensmithsound.uk 4 | -- @version 1.0 5 | -- @testedmacos 10.13.6 6 | -- @testedqlab 4.6.9 7 | -- @about Loads the selected cue to complete and starts it, leaving only any looping audio playing 8 | -- @separateprocess TRUE 9 | 10 | -- @changelog 11 | -- v1.0 + init 12 | 13 | 14 | tell application id "com.figure53.Qlab.4" to tell front workspace 15 | set theCue to last item of (selected as list) 16 | set cuePreWait to pre wait of theCue 17 | set cueDuration to duration of theCue 18 | set cuePostWait to post wait of theCue 19 | load theCue time (cuePreWait + cueDuration + cuePostWait) 20 | start theCue 21 | end tell --------------------------------------------------------------------------------