1- -- @description Create SQ Midi control cue
1+ -- @description Create A&H Midi control cue
22-- @author Ben Smith
33-- @link bensmithsound.uk
4- -- @version 1.0
4+ -- @version 1.1
55-- @testedmacos 10.14.6
66-- @testedqlab 4.6.10
7- -- @about Create an SQ Midi control cue
7+ -- @about Create a GLD / SQ Midi control cue in a separate cue list
88-- @separateprocess TRUE
99
1010-- @changelog
11+ -- v1.1 + ability to control whether you are asked for a name
12+ -- + Numbers midi cue to make it easier to find
1113-- v1.0 + init
1214
1315
@@ -31,6 +33,12 @@ on error
3133 set askForValue to " Cue Number"
3234end try
3335
36+ try
37+ askForName
38+ on error
39+ set askForName to true
40+ end try
41+
3442try
3543 cueColor
3644on error
@@ -40,14 +48,6 @@ end try
4048-- -------- END OF USER DEFINED VARIABLES --
4149
4250
43- -- VARIABLES FROM QLAB NOTES --------------
44-
45- -- ---------------- END OF QLAB VARIABLES --
46-
47-
48- property util : script " Applescript Utilities"
49-
50-
5151-- -- RUN SCRIPT ---------------------------
5252
5353tell application id " com.figure53.Qlab.4" to tell front workspace
@@ -62,8 +62,10 @@ tell application id "com.figure53.Qlab.4" to tell front workspace
6262 display dialog " Please provide " & askForValue with title cueTitle default answer ""
6363 set sceneNumber to (text returned of result ) as integer
6464
65- display dialog " Please provide cue name" with title " cueTitle" default answer ""
66- set sceneName to (text returned of result )
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
6769
6870 -- Construct midi message
6971 set bankNumHex to my calculateBank(sceneNumber)
@@ -93,8 +95,14 @@ tell application id "com.figure53.Qlab.4" to tell front workspace
9395
9496 -- Set cue
9597 set sysex message of midiCue to bankMessage & sceneMessage
96- set q name of midiCue to cueTitle & " : Scene " & sceneNumber & " - " & sceneName
97- set q color of midiCue to cueColor
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
98106
99107 -- put start cue in original cue list
100108 set current cue list to currentCueList
@@ -105,7 +113,11 @@ tell application id "com.figure53.Qlab.4" to tell front workspace
105113 make type " Start"
106114 set startCue to last item of (selected as list )
107115 set cue target of startCue to midiCue
108- set q name of startCue to cueTitle & " : Scene " & sceneNumber & " - " & sceneName
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
109121 set q color of startCue to cueColor
110122 if q type of (parent of startCue) is not " cue list" then
111123 set q color of (parent of startCue) to cueColor
@@ -154,3 +166,13 @@ on calculateScene(num)
154166
155167 set sceneNumHex to sceneHex
156168end 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
0 commit comments