General tips

-Many of these scripts were written for QLab 2, and need some adjustments to run properly in QLab 3. If you need help with a script that doesn't run correctly in QLab 3, post to our Google Group or email us at support@figure53.com-For a great collection of updated scripts from QLab user Rich Walsh, see this post.-Another great resource for both scripting and other advanced QLab tricks is Mic Pool's QLab Cookbook.- There are two ways to script QLab: with Script Cues, or by running a script externally (eg: as an application, in AppleScript Editor, in Automator or via the Script menulet - if enabled). NB: it's a very bad idea to run scripts in AppleScript Editor with the Event Log open (unless you are debugging), as it really slows things down…- Scripts run from within QLab don't need a tell application "QLab" clause. If you are developing your scripts in the Snow Leopard version of AppleScript Editor then you can enable show "tell" application pop-up menu on the Editing tab of the Preferences, which allows you to work as if you were within QLab - but with the benefit of event logging and error reporting.- Some scripts, such as level bumps, lend themselves to being called by a Hot Key to act on the currently selected cue in QLab; these scripts should exist in the workspace as Script Cues with Hot Keys to fire them. NB: because they are Hot Keys they will fire even if the workspace they are in isn't the current one!- Other scripts are best run externally - either because you won't need to run them more than once on a workspace, or because they interact with many other applications.- It's a good idea to put all your Hot Key scripts in a separate cue list that can be disarmed (and then eventually deleted) for show running.

Using the Script menulet

This is the most efficient way to run external scripts:

In Snow Leopard, open the General tab of AppleScript Editor's Preferences; in Leopard, open AppleScript Utility (in /Applications/AppleScript/).

Tick Show Script menu in menu bar.

Next to Show application scripts at: select top.

Create a folder called "Applications" in ~/Library/Scripts.

Put your QLab scripts in a folder called "QLab" in ~/Library/Scripts/Applications.

When QLab is the front application, you can run your scripts from the Script menu, ie: the icon that looks like an "S" (or a scroll) towards the top right of the screen.

If nothing seems to happen (or you don't get the result you are expecting), hold down the alt key whilst selecting the script: this will open it in AppleScript Editor instead of running it. From here you can run the script again with event logging and error reporting to help troubleshoot the issue. A common cause is that "UI element scripting" has not been enabled (see below).

If that's still not efficient enough for you (it does involve the mouse, after all!), you could create a Script Cue in QLab on a Hot Key to call one of these long external scripts, eg:

-- Replace the name of the script as necessary:run script(POSIXpathof(path toscriptsfolder)&"/Applications/QLab/Batch adjust selected.scpt")

UI element scripting

Some aspects of QLab (and other applications) are not directly scriptable, but can be controlled by a script via "UI element scripting". This sends commands to an application as if the user were using the mouse/keyboard to select menus, click checkboxes, etc. It is not turned on by default - you need to turn it on:

From the ''Apple Menu'', select ''System Preferences...'', then open the ''Universal Access'' pane; click ''Enable access for assistive devices''.

The three main commands that won't work without this are "click", "perform" and "select". The complete AppleScript terminology for UI scripting is available from the "Processes Suite" entries in the System Events AppleScript dictionary.

A well-written script that relies on UI element scripting should check that "UI elements enabled" is true before attempting to run code that won't work if it isn't! For example:

-- NOTE: This script is for QLab 2. It will not work with QLab 3-- Toggle status of "Use MIDI Show Control" preference-- This script works best as a Hot Key script-- This script won't work properly if there isn't a workspace open in QLab,-- or if the Workspace Preferences window is already open!tellapplication"System Events"ifUIelementsenabledthen-- Without the "ignoring" command, the script won't run in QLab-- as the Script Cue locks up the application and prevents QLab responding.ignoring application responsestellapplication"QLab"activateendtellkeystroke","using{commanddown}delay1-- This gives you a chance to see the current statetellapplicationprocess"QLab"tellfrontwindowsetselectedofrow3oftable1ofscrollarea1totrueclickcheckbox"Use MIDI Show Control"ofgroup"MIDI Show Control"ofgroup1endtellendtelldelay1-- This gives you a chance to see what happenedkeystroke","using{commanddown}endignoringelsetellapplication"System Preferences"activatesetcurrentpanetopane"com.apple.preference.universalaccess"display dialog"UI element scripting is not enabled. Check \"Enable access for assistive devices\"."endtellendifendtell

Basics

Starting a cue

Super-simple example of starting cue 1 in the front workspace.

tellapplication"QLab"tellfrontworkspacestartcue"1"endtellendtell

Boring technical stuff if you're interested: in the absence of any qualifying grammar, the "1" means the cue whose AppleScript name is "1"; for QLab, the AppleScript name of an object is its "q number" (as distinct from its "q name", ie: what appears in the "Q" column) - so, if you have a cue ''numbered'' "1" the above script will start it...

Level Bump for V3

This version just bumps the cue by the amount specified by the variable changeAmount -- I wanted a quick action, the dialog box from Rusty and Sam's version didn't work for me.

--Michael Portrie, mportrie@gmail.comtellapplicationid"com.figure53.qlab.3"totellfrontworkspace-- change this number to change the amount to bump by. setchangeAmountto-2.5settheSelectiontoselectedrepeatwitheachCueintheSelectionifqtypeofeachCueis"Audio"orqtypeofeachCueis"Fade"thentellfrontworkspacesetcurrentLeveltoeachCuegetLevelrow0column0setnewLeveltocurrentLevel+changeAmounteachCuesetLevelrow0column0dbnewLevelendtellendifendrepeatendtell

Add/Subtract Levels

Sam Kusnetz (Tested in QLab 2.2.6; Mac OS X 10.6.2)

I use this script bound to a hotkey such as control-L (for "level") so that I can easily respond to the sound designer saying things like "bump up those last three cues by 2 db." I command-click to select the cues, then hit my hotkey, type in +2, and enter. Boom.

display dialog"Change the master level of selected cues by this much:"defaultanswer"0"withtitle"Change Level"withicon1buttons{"Cancel","OK"}defaultbutton"OK"cancelbutton"Cancel"setchangeAmounttotext returnedofresultsettheSelectiontoselectedoffrontworkspacerepeatwitheachCueintheSelectionifqtypeofeachCueis"Audio"orqtypeofeachCueis"Fade"thentellfrontworkspacesetcurrentLeveltoeachCuegetLevelrow0column0setnewLeveltocurrentLevel+changeAmounteachCuesetLevelrow0column0dbnewLevelendtellendifendrepeat

Update for Qlab 3 Rusty Wandall (Tested with Qlab 3.1.11)

tellapplicationid"com.figure53.qlab.3"totellfrontworkspacedisplay dialog"Change the master level of selected cues by this much:"defaultanswer"0"withtitle"Change Level"withicon1buttons{"Cancel","OK"}defaultbutton"OK"cancelbutton"Cancel"setchangeAmounttotext returnedofresultsettheSelectiontoselectedrepeatwitheachCueintheSelectionifqtypeofeachCueis"Audio"orqtypeofeachCueis"Fade"thentellfrontworkspacesetcurrentLeveltoeachCuegetLevelrow0column0setnewLeveltocurrentLevel+changeAmounteachCuesetLevelrow0column0dbnewLevelendtellendifendrepeatendtell

Fades

Create fade out

Chris Ashworth

Create a Fade Cue directly under the selected Audio Cue which fades the audio to silence over 10 seconds:

tellapplication"QLab"setmySeltoselectedofworkspace1setoriginalCuetolastitemofmySelifqtypeoforiginalCueis"Audio"thentellworkspace1maketype"Fade"setmySeltoselected-- (QLab will select the newly created cue.)setnewCuetolastitemofmySelsetcuetargetofnewCuetooriginalCuesetdurationofnewCueto10newCuesetLevelrow0column0db-120endtellendifendtell

NB: alternate syntax for getting the selected cue:

setoriginalCuetolastitemof(selectedofworkspace1aslist)

Create fade out v2

Create a 5s default fade out (and stop) of the currently selected Group, Audio or Video Cue (or target of currently selected Fade Cue) as the next cue in the cue list (the script does not stop (targeted) Video Cues) [Hot Key]:

Create fade in (no follow-on)

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Create a 5s default fade in of the currently selected Audio Cue as the next cue in the cue list (also set the Master on the Levels tab of the Audio Cue to -INF and copy the Pre Wait time from the Audio Cue - for use in a "Fire all children simultaneously" Group Cue) [Hot Key]:

Build/dip

Create a 5s default fade of the currently selected Group, Audio or Video Cue (or target of currently selected Fade Cue) as the next cue in the cue list, adding 5dB to the Master on the Levels tab (the script does nothing if the selected Fade Cue targets a Group Cue) [Hot Key]:

setuserDurationto5setuserLevelto5-- Change this to -5 for a dipsetkindStringto"Build: "-- Change this to "Dip: "tellfrontworkspacesetoriginalCuetolastitemof(selectedaslist)setoriginalCueTypetoqtypeoforiginalCueiforiginalCueTypeis"Group"thenmaketype"Fade"setnewCuetolastitemof(selectedaslist)setcuetargetofnewCuetooriginalCuesetdurationofnewCuetouserDurationnewCuesetLevelrow0column0dbuserLevelsetqnameofnewCuetokindString&qnameoforiginalCueelseiforiginalCueTypeis in{"Audio","Video"}thenmaketype"Fade"setnewCuetolastitemof(selectedaslist)setcuetargetofnewCuetooriginalCuesetdurationofnewCuetouserDurationsetcurrentLeveltooriginalCuegetLevelrow0column0newCuesetLevelrow0column0db(currentLevel+userLevel)setqnameofnewCuetokindString&qnameoforiginalCueelseiforiginalCueTypeis"Fade"thensetoriginalCueTargettocuetargetoforiginalCueifqtypeoforiginalCueTargetis not"Group"thenmaketype"Fade"setnewCuetolastitemof(selectedaslist)setcuetargetofnewCuetooriginalCueTargetsetdurationofnewCuetouserDurationsetcurrentLeveltooriginalCuegetLevelrow0column0newCuesetLevelrow0column0db(currentLevel+userLevel)setqnameofnewCuetokindString&qnameoforiginalCueTargetendifendifendtell

Crash fades

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Crash selected Fade Cue(s) to just before completion, starting their target cues (the script will start the target Audio Cue(s) for the selected Fade Cue(s), load the Fade Cue(s) to just before completion and start them) [Hot Key]:

setuserDurationto1-- This is the time remaining to which to load the Fade Cue(s) before starting themrepeatwitheachCuein(selectedoffrontworkspaceaslist)ifqtypeofeachCueis"Fade"thenifrunningofcuetargetofeachCueisfalsethenstartcuetargetofeachCueendifstopeachCue-- In case the Fade Cue is a follow-on from its targetseteachDurationto((prewaitofeachCue)+(durationofeachCue))-- Include the Pre Wait for effective duration!ifeachDuration>userDurationthenloadeachCuetimeeachDuration-userDurationendifstarteachCueendifendrepeat

Force fades

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Force selected Fade Cue(s) to completion (the script will also act on Fade Cues within selected Group Cues) [Hot Key]:

setuserDurationto1-- This is the time the fade(s) will be forced to complete insetuserEnterIntoGroupstotrue-- Set this to false if you don't want the script to act on Fade Cues within selected Group CuestellfrontworkspacesetcuesToProcessto(selectedaslist)setprocessedIDsto{}setfadeCuesto{}setoriginalPreWaitsto{}setoriginalDurationsto{}setoriginalContinueModesto{}setcountCuestocountcuesToProcesssetito0repeatuntili=countCues-- Extract just the Fade CuesseteachCuetoitem(i+1)ofcuesToProcessseteachTypetoqtypeofeachCueifeachTypeis"Fade"thenseteachIDtouniqueIDofeachCueifeachIDis notinprocessedIDsthensetendoffadeCuestoeachCuesetendofprocessedIDstoeachIDendifelseifuserEnterIntoGroupsistrueandeachTypeis"Group"thensetcuesToProcesstocuesToProcess&cuesofeachCuesetcountCuestocountcuesToProcessendifsetitoi+1endrepeatrepeatwitheachCueinfadeCuesstopeachCuesetendoforiginalPreWaitstoprewaitofeachCuesetendoforiginalDurationstodurationofeachCuesetendoforiginalContinueModestocontinuemodeofeachCuesetprewaitofeachCueto0setdurationofeachCuetouserDurationsetcontinuemodeofeachCuetodo_not_continuestarteachCueendrepeatdelayuserDuration+0.1-- Give the cue(s) time to complete before resetting to the original variablesrepeatwithifrom1tocountfadeCuesseteachCuetoitemioffadeCuesstopeachCue-- In case of Post Wait…setprewaitofeachCuetoitemioforiginalPreWaitssetdurationofeachCuetoitemioforiginalDurationssetcontinuemodeofeachCuetoitemioforiginalContinueModesendrepeatendtell

Force running fades

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Force running Fade Cue(s) to completion [Hot Key]:

setuserDurationto1-- This is the time the fade(s) will be forced to complete intellfrontworkspacesetfadeCuesto{}setoriginalPreWaitsto{}setoriginalDurationsto{}setoriginalContinueModesto{}repeatwitheachCuein(activecuesaslist)-- Extract just the Fade CuesifqtypeofeachCueis"Fade"thensetendoffadeCuestoeachCueendifendrepeatrepeatwitheachCueinfadeCuesstopeachCuesetendoforiginalPreWaitstoprewaitofeachCuesetendoforiginalDurationstodurationofeachCuesetendoforiginalContinueModestocontinuemodeofeachCuesetprewaitofeachCueto0setdurationofeachCuetouserDurationsetcontinuemodeofeachCuetodo_not_continuestarteachCueendrepeatdelayuserDuration+0.1-- Give the cue(s) time to complete before resetting to the original variablesrepeatwithifrom1tocountfadeCuesseteachCuetoitemioffadeCuesstopeachCue-- In case of Post Wait…setprewaitofeachCuetoitemioforiginalPreWaitssetdurationofeachCuetoitemioforiginalDurationssetcontinuemodeofeachCuetoitemioforiginalContinueModesendrepeatendtell

Audio Cues

Edit target file

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Edit selected Audio Cue's target (in Audacity); if Audacity takes more than 60s to open, the script will time out before switching to it; remember to "Refresh Files" after you've edited [Hot Key]:

setuserApplicationtoapplication"Audacity"-- This can be changed to the editor of your choicetellfrontworkspacesetselectedCuetolastitemof(selectedaslist)ifqtypeofselectedCueis"Audio"thensetfileTargettofiletargetofselectedCueignoring application responsestelluserApplicationopenfileTargetactivateendtellendignoringendifendtell

Open target file

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Open selected Audio Cue's target (it will open the audio file in whichever application it is set to "Open with" - in the Finder's Get Info window) [Hot Key]:

Convert to wav for QLab 2

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Convert selected Audio Cue's target to wav, if it isn't one already (using the "afconvert" command line utility: can be modified to convert to aiff instead; the script keeps times but resets the cue's name; bit depth and sample rate are user-defined within the script) [Hot Key]:

Convert to wav for QLab 3

Convert selected Audio Cue targets to wav, if it isn't one already (using the "afconvert" command line utility: can be modified to convert to aiff instead; the script keeps times but resets the cue's name; bit depth and sample rate are user-defined within the script) [Hot Key]:

-- I have merely updated his original script from Rich Walsh in order to be compatible with QLab 3-- I have copied all available properties apart from levels etc - some of these might not be required or operate in unexpected ways,-- but I currently lack time or inclination to test :)setuserFormattoitem1of{"wav","aif"}-- Change this to "item 2" to convert to aiffsetuserBitDepthto16setuserBitRateto44100-- DeclarationsglobaldialogTitlesetdialogTitleto"Convert to "&userFormat-- Prepare some variablesifuserFormatis"wav"thensetacceptableTypesto{"com.microsoft.waveform-audio"}setformatStringto"WAVE -d LEI"elseifuserFormatis"aif"thensetacceptableTypesto{"public.aifc-audio","public.aiff-audio"}setformatStringto"AIFF -d BEI"elsereturn-- Protection against erroneous user modificationendif-- Convert the cuesetcreatedCuesto{}aslistsetallCuesto(selectedoffrontworkspaceaslist)repeatwithselectedCueinallCuesifqtypeofselectedCueis"Audio"thentrysetcurrentFileTargettofiletargetofselectedCueasaliastellapplication"System Events"setcurrentTypetotypeidentifierofcurrentFileTargetendtellifcurrentTypeis notinacceptableTypesthensetcurrentPatchtopatchofselectedCuesetcurrentStarttostarttimeofselectedCuesetcurrentEndtoendtimeofselectedCuesetcurrentPlayCounttoplaycountofselectedCuesetcurrentinfLooptoinfiniteloopofselectedCuesetcurrentRatetorateofselectedCuesetcurrentIntegratedFadetointegratedfadeofselectedCuesetcurrentPitchShifttopitchshiftofselectedCuetellapplication"System Events"settheContainertopathofcontainerofcurrentFileTargetsettheExtensiontonameextensionofcurrentFileTargetiftheExtensionis""thensettheNametonameofcurrentFileTargetelsesettheFullNametonameofcurrentFileTargetsettheNametotext1through(-1-(lengthoftheExtension))oftheFullNameendifsetnewFileTargettotheContainer&theName&userFormatsetfileExiststoexistsfilenewFileTargetendtelliffileExistsistruethendisplay dialog"The destination file for the conversion already exists. What now?"withtitledialogTitle¬
withicon0buttons{"Cancel","Replace"}defaultbutton"Replace"cancelbutton"Cancel"endifdo shell script"afconvert -f "&formatString&userBitDepth&"@"&userBitRate&" "&¬
quoted formofPOSIXpathofcurrentFileTarget&" "&quoted formofPOSIXpathofnewFileTargetsetfiletargetofselectedCuetonewFileTargetsetpatchofselectedCuetocurrentPatchsetstarttimeofselectedCuetocurrentStartsetendtimeofselectedCuetocurrentEndsetplaycountofselectedCuetocurrentPlayCountsetinfiniteloopofselectedCuetocurrentinfLoopsetrateofselectedCuetocurrentRatesetintegratedfadeofselectedCuetocurrentIntegratedFadesetpitchshiftofselectedCuetocurrentPitchShiftsetqnameofselectedCuetotheName&userFormat-- Remove this line if you don't want to reset the cue name tooendifendtryendifendrepeatdisplay dialog"Done."withtitledialogTitlewithicon1buttons{"OK"}defaultbutton"OK"givingupafter5

Times

Total Time

Michael Portrie (Last tested with Qlab 3.1.2 & Mac OS X 10.10.2)

Adds together the total durations of the selected cues, and displays the total in a pop-up window.

--Created Mar 2, 2015 by Michael Portrie--mportrie@gmail.com--This script was written for Qlab 3, last tested with Mac OS X 10.10.2tellapplicationid"com.figure53.qlab.3"totellfrontworkspacesetappTimeto0setthisTimeto0repeatwitheachCuein(selectedaslist)trysetthisTimeto(durationofeachCue)setappTimetothisTime+appTimeendtryendrepeatsetappHoursto(appTimediv3600)setappHoursRemainderto(appTimemod3600)setappMinutesto(appHoursRemainderdiv60)setappSecondsto(round(appHoursRemaindermod60))display dialog"The total time of the selected cues is
"&appHours&":"&appMinutes&":"&appSeconds&"
(h)(m)(s)"withtitle"Total Time - by Michael Portrie"withicon1endtell

Show total time for selected cues (updated)

No more estimating the total length of the audio files for pre-show or intermission music. Just select them and press the hot-key that you have associated with this script!

--Created by Michael Portrie <mportrie@gmail.com>-- Updated by Tim Rogers <timmrogers@gmail.com>tellapplicationid"com.figure53.qlab.3"totellfrontworkspacesettotalSecondsto0setthisSecondsto0repeatwitheachCuein(selectedaslist)trysetthisSecondsto(durationofeachCue)settotalSecondstothisSeconds+totalSecondsendtryendrepeatsethtototalSecondsdiv3600setstototalSeconds-h*3600setmtosdiv60setstos-m*60ifh<10thensethtotext-2thru-1of("00"&h)elsesethtohas textendififm<10thensetmtotext-2thru-1of("00"&m)ifs<10thensetstotext-2thru-1of("00"&s)setprettySecondsto(h&":"&m&":"&s)display dialog"The total time of the selected cues is "&prettySecondswithtitle"Total Time"withicon1endtell

Show total time for selected cues (Alternate)

Another option for seeing total length of the audio files but through notifications so you never loose control of your workspace.

Effective duration

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Set Post Wait(s) of selected Group Cue(s) to effective duration (for those times when a countdown display is useful...) [Hot Key]:

-- The effective duration of a Group Cue is the time it will take for the longest of its children to complete, ie: the longest effective duration of one of its children-- Each child cue has an effective Pre Wait, which is the cumulative time that must elapse before this child's Pre Wait is triggered-- In a "Fire all children simultaneously" Group Cue this effective Pre Wait is 0-- In a "Fire first child and go to next cue" Group Cue this effective Pre Wait is the sum of all the Pre Waits and Post Waits that have come before-- Note that auto-follow cues use their Durations as Post Waits (the actual Post Wait property is ignored); this is the value that must be added to the sum above-- The effective duration of a single cue that does not auto-follow is the sum of its effective Pre Wait, Duration & Post Wait-- The effective duration of a single cue that does auto-follow is the sum of its effective Pre Wait & DurationrepeatwitheachCuein(selectedoffrontworkspaceaslist)tryseteachModetomodeofeachCuesetlongestChildEffectiveDurationto0ifeachModeisfire_allthenrepeatwitheachChildincuesofeachCueseteachChildEffectiveDurationto(prewaitofeachChild)+(durationofeachChild)+(postwaitofeachChild)ifeachChildEffectiveDuration>longestChildEffectiveDurationthensetlongestChildEffectiveDurationtoeachChildEffectiveDurationendifendrepeatendififeachModeisfire_first_go_to_next_cuethenseteffectivePreWaitto0repeatwitheachChildincuesofeachCueseteachPretoprewaitofeachChildseteffectivePreWaittoeffectivePreWait+eachPreseteachContinueModetocontinuemodeofeachChildifeachContinueModeisauto_followthenseteachPosttodurationofeachChildseteachChildEffectiveDurationtoeffectivePreWait+eachPostelseseteachPosttopostwaitofeachChildseteachChildEffectiveDurationtoeffectivePreWait+(durationofeachChild)+eachPostendifseteffectivePreWaittoeffectivePreWait+eachPostifeachChildEffectiveDuration>longestChildEffectiveDurationthensetlongestChildEffectiveDurationtoeachChildEffectiveDurationendififeachContinueModeisdo_not_continuethenexitrepeat-- No point looking at any further children that aren't part of the sequenceendifendrepeatendifsetpostwaitofeachCuetolongestChildEffectiveDurationendtryendrepeat

Create adjustable auto-follow

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Set a cue to auto-continue, but with the Post Wait preset to be the same as its Duration (or, optionally, a fixed amount more/less for gaps/overlaps) - like an auto-follow cue, but one where you can change the auto-follow time [Hot Key]:

setuserDeltato0-- Change this to a negative value to have cues overlaprepeatwitheachCuein(selectedoffrontworkspaceaslist)setpostwaitofeachCueto((durationofeachCue)+userDelta)setcontinuemodeofeachCuetoauto_continueendrepeat

Batch adjusting

Reset names

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Reset name of selected cue(s) (the script will reset the name of an Audio, Video or MIDI File Cue to its File Target, name other types of cue based on their type and Cue Target, or name MIDI Cues based on their parameters; other cues that have neither File nor Cue Target are unaffected) [Hot Key]:

Update filenames

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Update filename of File Target for selected cue(s) (the script will change the name of the File Target on disk for an Audio, Video or MIDI File Cue to be the same as the name of the cue; QLab's display won't update until you change the selection) [Hot Key]:

repeatwitheachCuein(selectedoffrontworkspaceaslist)tryseteachNametoqnameofeachCueseteachTargettofiletargetofeachCueasalias-- This line will log an exception innocuously in the Console if it throws an error, despite the try blocktellapplication"System Events"seteachExtensiontonameextensionofeachTargetifeachNamedoesnotend witheachExtensionthensetnameofeachTargettoeachName&"."&eachExtensionelsesetnameofeachTargettoeachNameendifendtellendtryendrepeat

Toggle arming

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Toggle arming of selected cue(s) (the script will arm/disarm the current cue list if no cues are selected) [Hot Key]:

tellfrontworkspacesetselectedCuesto(selectedaslist)if(countselectedCues)is0then-- If no cues are selected arm/disarm the current cue listsetarmedofcurrentcuelisttonotarmedofcurrentcuelistelserepeatwitheachCueinreverseofselectedCues-- Reversed so as to do a Group Cue's children before itsetarmedofeachCuetonotarmedofeachCueendrepeatendifendtell

Batch disarm

Arm, disarm or toggle arming of all cues in the workspace whose name contains the string you enter (not case-sensitive); the string is copied to the Clipboard for you to paste in next time [Hot Key]:

setuserDefaultSearchStringto"REHEARSAL"-- Use this to specify the default search string-- DeclarationsglobaldialogTitlesetdialogTitleto"Batch disarm"-- Get the search stringset{theText,theButton}to{text returned,button returned}of(display dialog¬
"Arm/disarm cues whose name contains (return an empty string to cancel):"withtitledialogTitlewithicon1¬
defaultansweruserDefaultSearchStringbuttons{"Toggle","Arm","Disarm"}defaultbutton"Disarm")-- Check for canceliftheTextis""thenerrornumber-128endif-- Copy the search string to the Clipboard and arm/disarm the cuesset the clipboard totheTexttellfrontworkspacesetfoundCuestoeverycuewhoseqnamecontainstheTextsetfoundCuesReftoareference tofoundCuesrepeatwitheachCueinreverseoffoundCuesRef-- Reversed so as to do a Group Cue's children before itiftheButtonis"Arm"thensetarmedofeachCuetotrueelseiftheButtonis"Disarm"thensetarmedofeachCuetofalseelsesetarmedofeachCuetonotarmedofeachCueendifendrepeatendtell

Batch adjust continue mode

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Batch adjust continue mode of selected cue(s) (the script presents a dialog for you to choose the continue mode to apply) [Hot Key]:

Navigation

Mark/Jump

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Mark selected cue, or jump to previously marked cue (the script uses the Notes field of the Script Cue to store information about the marked cue: if there is no selection, the script will jump to the marked cue; if no cue has been marked, the script will mark the selected cue; if there is a selection and a cue has previously been marked, the script will ask what to do next) [Hot Key]:

-- This script only works if "Playback position is always the selected cue" is ON!-- DeclarationsglobaldialogTitle,thisCuesetdialogTitleto"Mark/Jump"-- Main routinetellfrontworkspacesetthisCuetolastitemof(activecuesaslist)-- This should identify this Script CueifqtypeofthisCueis"Script"then-- Slight error protectionsetmyNotestonotesofthisCuesetselectedCuesto(selectedaslist)if(countselectedCues)is0then-- There is no selected cue: we are jumpingifmyNotesis not""then-- Just in case there is no stored cue eithermyjumpToCue(myNotes)endifelseifmyNotesis""then-- There is no stored cue: we are markingmymarkCue(lastitemofselectedCues)elseifmyNotesbegins with"This script uses the Notes field"then-- This cue still contains the template text: we are markingmymarkCue(lastitemofselectedCues)else-- There is a stored cue, but we'll check what is requiredsettheButtontobutton returnedof(display dialog"Jump to stored cue?"withtitledialogTitle¬
withicon1buttons{"Mark","OK"}defaultbutton"OK")iftheButtonis"OK"then-- We are jumpingmyjumpToCue(myNotes)else-- We are markingmymarkCue(lastitemofselectedCues)endifendifendifendifendtell-- SubroutinesonmarkCue(cueToMark)setnotesofthisCuetouniqueIDofcueToMarkendmarkCueonjumpToCue(jumpToID)tellfrontworkspacesetnotesofthisCueto""trysetjumpCuetocueidjumpToIDsettheContainertoparentofjumpCuerepeatuntilmodeoftheContaineriscue_listsettheContainertoparentoftheContainerendrepeatsetcurrentcuelisttotheContainersetplaybackpositionofcurrentcuelisttojumpCueendtryendtellendjumpToCue

Jump to Cue Target

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Jump to selected cue's target cue [Hot Key]:

-- This script only works if "Playback position is always the selected cue" is ON!tellfrontworkspacesetselectedCuetolastitemof(selectedaslist)trysetcueTargettocuetargetofselectedCuesettheContainertoparentofcueTargetrepeatuntilmodeoftheContaineriscue_listsettheContainertoparentoftheContainerendrepeatsetcurrentcuelisttotheContainersetplaybackpositionofcurrentcuelisttocueTargetendtryendtell

Go to next broken cue

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Go to next broken cue in current cue list [Hot Key] - this is considerably faster in a large workspace than the above approach (and can be adjusted to search for other properties; only scrolls down ("next"), not up ("previous")!):

-- This script only works if "Playback position is always the selected cue" is ON!tellfrontworkspacetrysetcurrentCuetouniqueIDofplaybackpositionofcurrentcuelist-- This will throw an error if there is no selectionsetallCuestouniqueIDofcuessetallCuesReftoareference toallCuessetcountCuestocountallCuesRefsetfoundCuestouniqueIDofcueswhosebrokenistrue-- Change this line to search for different properties, eg: q type is "Audio"setfoundCuesReftoareference tofoundCuessetcurrentIndextocountCues-1-- Find where we are in the listrepeatwithifrom1tocountCuesifitemiofallCuesRefiscurrentCuethensetcurrentIndextoiexitrepeatendifendrepeat-- Find the next "found" cue in the listrepeatwithjfromcurrentIndex+1tocountCuessetfoundIndextoitemjofallCuesRefiffoundIndexis infoundCuesRefthensetplaybackpositionofcurrentcuelisttocueidfoundIndexexitrepeatendifendrepeatendtryendtell

Loading

Load to time

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Load selected cue(s) to a time you enter [Hot Key]:

-- DeclarationsglobaldialogTitlesetdialogTitleto"Load to time"-- Check the clipboard for a previous timesetcurrentTIDstoAppleScript's textitemdelimiterssetAppleScript's textitemdelimitersto""-- Can't assume thistrysetclipboardContentstothe clipboard-- The time requested previously will have been copied to the Clipboard, and may still be on thereonerrorsetclipboardContentsto""endtryif(countparagraphsofclipboardContents)>1or(countwordsofclipboardContents)>2or¬
((countwordsofclipboardContents)>1andclipboardContentsdoes not contain":")then-- Slight protection against spurious Clipboard contentssetclipboardContentsto""endif-- Prompt to get the timesettheTextto""repeatuntiltheTextis not""set{theText,theButton}to{text returned,button returned}of(display dialog¬
"Load selected cues to this time (seconds or minutes:seconds):"withtitledialogTitlewithicon1¬
defaultanswerclipboardContentsbuttons{"Start the cues too","Cancel","OK"}defaultbutton"OK"cancelbutton"Cancel")setclipboardContentsto""trysettheTimetotheTextasnumberiftheTime<0thensettheTextto""endifonerroriftheTextcontains":"thentrysetAppleScript's textitemdelimitersto":"settheMinutestoword1oftheTextsettheSecondstorestofwordsoftheTextas stringsettheTimeto(theMinutesasnumber)*60+(theSecondsasnumber)onerrorsettheTextto""endtryelsesettheTextto""endifendtryendrepeatsetAppleScript's textitemdelimiterstocurrentTIDs-- Copy the time to the Clipboardset the clipboard totheText-- Load (and start) the cuestellfrontworkspaceloadselectedtimetheTimeiftheButtonis"Start the cues too"thenstartselectedendifendtell

Jump into a string of cues

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Jump into a string of cues; the script rather assumes that you are working in such a way that every cue that is triggered by a manual GO is a Group Cue (either "Fire all children simultaneously" or "Fire first child and go to next cue"). In addition to Group Cues, it will also process any selected Memo Cues - but it will ignore all other cue types. For best results, select the first Group Cue that should still be playing and all intervening cues up to and including the last Group Cue you wish to jump into, but not any of its children. [Hot Key]

-- DeclarationsglobaldialogTitlesetdialogTitleto"Jump into a string of cues"-- Main routinetellfrontworkspace-- Check more than one cue selectedtrysetselectedCuestoitems1thru-2of(selectedaslist)onerrordisplay dialog"You need to select more than one cue!"withtitledialogTitlewithicon0buttons{"OK"}defaultbutton"OK"givingupafter5returnendtry-- Check the clipboard for a previous timesetcurrentTIDstoAppleScript's textitemdelimiterssetAppleScript's textitemdelimitersto""-- Can't assume thistrysetclipboardContentstothe clipboard-- The time requested previously will have been copied to the Clipboard, and may still be on thereonerrorsetclipboardContentsto""endtryif(countparagraphsofclipboardContents)>1or(countwordsofclipboardContents)>2or¬
((countwordsofclipboardContents)>1andclipboardContentsdoes not contain":")then-- Slight protection against spurious Clipboard contentssetclipboardContentsto""endif-- Prompt to get the timesettheTextto""repeatuntiltheTextis not""settheTexttotext returnedof(display dialog"This script will load the last selected cue to the time you enter below and attempt "&¬
"to load any other Group Cues selected so that any fades will effectively have completed when you start the selected cues."&return&return&¬
"THIS IS NOT GUARANTEED TO WORK!"&return&return&¬
"Enter the load time (seconds or minutes:seconds):"withtitledialogTitlewithicon1¬
defaultanswerclipboardContentsbuttons{"Cancel","OK"}defaultbutton"OK"cancelbutton"Cancel")setclipboardContentsto""trysettheTimetotheTextasnumberiftheTime<0thensettheTextto""endifonerroriftheTextcontains":"thentrysetAppleScript's textitemdelimitersto":"settheMinutestoword1oftheTextsettheSecondstorestofwordsoftheTextas stringsettheTimeto(theMinutesasnumber)*60+(theSecondsasnumber)onerrorsettheTextto""endtryelsesettheTextto""endifendtryendrepeatsetAppleScript's textitemdelimiterstocurrentTIDs-- Copy the time to the Clipboardset the clipboard totheText-- Clean out cues that won't be processed, and prepare a list for checking to see if remaining selection contains its own children…setselectedCuesCleanto{}setchildrenIDsto{}repeatwitheachCueinselectedCuesifqtypeofeachCueis in{"Group","Memo"}thensetendofselectedCuesCleantoeachCuetrysetchildrenIDstochildrenIDs&uniqueIDofcuesofeachCueendtryendifendrepeat-- Exit if no cues left to processif(countselectedCuesClean)is0thendisplay dialog"Not enough Group or Memo Cues selected to proceed."withtitledialogTitle¬
withicon0buttons{"OK"}defaultbutton"OK"givingupafter5returnendif-- Work out the total time to which to load, and temporarily set each Group/Memo Cue to auto-continuesetlongestGroupTimeto0setsummedWaitsto0setprocessedCuesto{}setcontinueModesto{}repeatwitheachCueinselectedCuesCleantrysetgroupTimeto0tryseteachModetomodeofeachCueonerror-- Memo CueseteachModeto""endtry-- Skip cues that are children of selected Group CuesifuniqueIDofeachCueis inchildrenIDsthenerrorendif(*Thetotaltimeofa"Fire all children simultaneously"GroupCue-thetimetowhichtoloaditto"complete"-isthesumofthePreWaitandDurationoftheFadeCuethatwilltakelongesttocomplete*)ifeachModeisfire_allthensetfadeCuesto(everycueofeachCuewhoseqtypeis"Fade")setlongestChildFadeTimeto0repeatwitheachChildinfadeCuesseteachChildFadeTimeto(prewaitofeachChild)+(durationofeachChild)ifeachChildFadeTime>longestChildFadeTimethensetlongestChildFadeTimetoeachChildFadeTimeendifendrepeatsetgroupTimetolongestChildFadeTimeendif(*Thetotaltimeofa"Fire first child and go to next cue"GroupCue-thetimetowhichtoloaditto"complete"-isthesumofallthePreWaitsandPostWaitsofcuesthatcontinue,plustheDurationofthelongestFadeCue*)ifeachModeisfire_first_go_to_next_cuethensetlongestChildFadeTimeto0repeatwitheachChildincuesofeachCuesetgroupTimetogroupTime+(prewaitofeachChild)seteachContinueModetocontinuemodeofeachChildifeachContinueModeisauto_continuethensetgroupTimetogroupTime+(postwaitofeachChild)ifqtypeofeachChildis"Fade"thenseteachChildFadeTimetodurationofeachChildifeachChildFadeTime>longestChildFadeTimethensetlongestChildFadeTimetoeachChildFadeTimeendifendifelseifeachContinueModeisauto_followthensetgroupTimetogroupTime+(durationofeachChild)elseexitrepeat-- No point looking at children that aren't part of the sequence; Pre Wait of next child is counted thoughendifendrepeatsetgroupTimetogroupTime+longestChildFadeTimeendif-- Since the Group Cues are being set to auto-continue, loading to the longest of their total times will load them all to "completion"ifgroupTime>longestGroupTimethensetlongestGroupTimetogroupTimeendif(*IfanyoftheGroup/MemoCueshavenon-zeroPreorPostWaitsthenthesewilleffectivelyextendthetimetowhichwehavetoload,sothesearesummedtoo*)setendofprocessedCuestoeachCuesetendofcontinueModestocontinuemodeofeachCuesetcontinuemodeofeachCuetoauto_continuesetsummedWaitstosummedWaits+(prewaitofeachCue)ifcontentsofeachCueis notlastitemofselectedCuesCleanthen(*Don'tincludethepenultimatecue's Postwaitinthesumasitwillbesettemporarilyto0*)setsummedWaitstosummedWaits+(postwaitofeachCue)endifendtryendrepeat-- Temporarily change Post Wait of penultimate Group/Memo Cue in selection so that when the string is loaded all other cues will "complete"setlastPosttopostwaitoflastitemofselectedCuesCleansetpostwaitoflastitemofselectedCuesCleantolongestGroupTime+summedWaits-- Load the cue string and prompt to start itloadfirstitemofselectedCuesCleantimelongestGroupTime+summedWaits+theTime-- This includes the load to time specified by the user in the dialogtry-- This try means that the rest of the script will complete even if the user cancelsdisplay dialog"Ready to go?"withtitledialogTitlewithicon1buttons{"Cancel","OK"}defaultbutton"OK"cancelbutton"Cancel"startfirstitemofselectedCuesCleanendtry-- Reset the cuesrepeatwithifrom1tocountprocessedCuessetcontinuemodeofitemiofprocessedCuestoitemiofcontinueModesendrepeatsetpostwaitoflastitemofselectedCuesCleantolastPostendtell

Stop All but Group

Some dudes (Last tested with QLab 3.1.9 & Mac OS X 10.10.3)

This script is meant to be placed as the first child in a group, if you target the group and click go, it will run everything in the group but stop anything outside the group. A self-contained stop. It is meant to function with mode: "Start first child and go to next cue"

Add files from iTunes

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Take selected files in iTunes, add them to the cue list and set the names to match (the script will also attempt to remove track numbers from the start of the names); remember to bundle the workspace at some point to get the audio files in the right place [Hot Key]:

setuserAttemptToRemoveTrackNumberstotrue-- Set this to false if you don't mind having track numbers in your cue descriptions-- DeclarationsglobaldialogTitlesetdialogTitleto"Add files from iTunes"-- Check iTunes is runningtellapplication"System Events"setiTunesIsOpentocount(everyprocesswhosenameis"iTunes")endtellifiTunesIsOpenis0thendisplay dialog"iTunes is not running."withtitledialogTitlewithicon0buttons{"OK"}defaultbutton"OK"givingupafter5returnendif-- Test for a selectiontellapplication"iTunes"setiTunesHasSelectiontocount(selectionaslist)endtellifiTunesHasSelectionis0thendisplay dialog"There is no selection in iTunes."withtitledialogTitlewithicon0buttons{"OK"}defaultbutton"OK"givingupafter5returnendif-- Offer escape hatchdisplay dialog"Adding selected files from iTunes..."withtitledialogTitlewithicon1¬
buttons{"Cancel","OK"}defaultbutton"OK"cancelbutton"Cancel"givingupafter3-- You have 3s to change your mind-- Get the filestellapplication"iTunes"setselectedFilesto(locationofselection)aslistendtell-- Get the namessetselectedNamesto{}tellapplication"System Events"repeatwitheachIteminselectedFilessetendofselectedNamestonameofeachItemendrepeatendtell-- Attempt to remove track numbers, as necessarysetcleanedNamesto{}setcurrentTIDstoAppleScript's textitemdelimiterssetAppleScript's textitemdelimitersto""-- Can't assume thisrepeatwitheachNameinselectedNamesifuserAttemptToRemoveTrackNumbersistrueandfirstcharacterofeachNameis incharactersof"0123456789"thenseteachNameto(characters((offsetofspaceineachName)+1)thruendofeachName)as text(*InSnowLeopard,changestoScriptingAdditionsecurityresultindoublesendingif,forexample,"offset"isputinsideatellblock*)endifsetendofcleanedNamestoeachNameendrepeatsetAppleScript's textitemdelimiterstocurrentTIDs-- Add the filestellfrontworkspacerepeatwithifrom1tocountselectedFilesmaketype"Audio"setnewCuetolastitemof(selectedaslist)setfiletargetofnewCuetoitemiofselectedFilessetqnameofnewCuetoitemiofcleanedNamesendrepeatendtelldisplay dialog"Done."withtitledialogTitlewithicon1buttons{"OK"}defaultbutton"OK"givingupafter5

Add files from iTunes v2

''Oliver Waring''

I have added an option for the selected files to Auto Continue:

display dialog"Adding selected files from iTunes..."withtitle"QLab script"withicon0buttons{"Cancel","OK"}defaultbutton"OK"cancelbutton"Cancel"givingupafter3-- You have 3s to change your mindtellapplication"iTunes"setselectedFilesto(locationofselection)aslistendtellsetselectedNamesto{}tellapplication"System Events"repeatwitheachIteminselectedFilessetselectedNamestoselectedNames&nameofeachItemendrepeatendtellsetautocontinuetothebutton returnedof(display dialog"Would you like these cues to Auto Follow?"withtitle"Auto Continue"withicon1buttons{"No","Yes"}defaultbutton"Yes")repeatwithifrom1tocountofselectedFilesmakefrontworkspacetype"Audio"setnewCuetolastitemof(selectedoffrontworkspaceaslist)setfiletargetofnewCuetoitemiofselectedFilessetqnameofnewCuetoitemiofselectedNamesifautocontinue="Yes"thensetcontinuemodeofnewCuetoauto_followendifendrepeat

Make slideshow from selected cues

-- Create slideshow from selected cues-- Tim Rogers <timmrogers@gmail.com>tellapplicationid"com.figure53.qlab.3"totellfrontworkspacedisplay dialog"Enter the number of seconds between cues:"withtitle"Cues"withicon1defaultanswer"10"trysetmyPostWaitto(text returnedofresult)asnumberonerrordisplay alert"Invalid number"message"Please enter a valid number."returnendtrysetmySelectedto(selectedaslist)setmyCountto(countmySelected)repeatwithmyCurrentCueinmySelected-- Get the uniqueID of the current cuesetmyIDtouniqueIDofmyCurrentCue-- Move the selection to the current cue tellthecurrentcuelistsetplaybackpositiontocueidmyIDendtell-- Set opacity and continue mode of the current cuesetopacityofmyCurrentCueto0setcontinuemodeofmyCurrentCuetoauto_continue-- If first selected cue ifmyCurrentCue's contentsisthefirstitemofmySelectedthen-- Make new fade cuemaketype"Fade"-- and find its namesetmyNewCueListtoselectedsetmyNewCuetolastitemofmyNewCueList-- and set its target, opacity, and post waitsetcuetargetofmyNewCuetomyCurrentCuesetopacityofmyNewCueto100setdoopacityofmyNewCuetotruesetpostwaitofmyNewCuetomyPostWaitsetcontinuemodeofmyNewCuetoauto_continue-- Set previous cuesetmyPreviousCuetomyCurrentCue-- Otherwiseelse-- Make new fade cuemaketype"Fade"-- and find its namesetmyNewCueListtoselectedsetmyNewCuetolastitemofmyNewCueList-- and set its target and opacitysetcuetargetofmyNewCuetomyCurrentCuesetopacityofmyNewCueto100setdoopacityofmyNewCuetotruesetcontinuemodeofmyNewCuetoauto_continue-- Make new fade-and-stop cuemaketype"Fade"-- and find its namesetmyNewCueListtoselectedsetmyNewCuetolastitemofmyNewCueList-- and set its target, opacity, post wait, and stopsetcuetargetofmyNewCuetomyPreviousCuesetopacityofmyNewCueto0setdoopacityofmyNewCuetotruesetpostwaitofmyNewCuetomyPostWaitsetstoptargetwhendoneofmyNewCuetotruesetcontinuemodeofmyNewCuetoauto_continue-- Set previous cuesetmyPreviousCuetomyCurrentCueendifendrepeatendtell

Start QAutoSaver

tellapplication"System Events"if(count(everyprocesswhosenameis"QAutoSaver"))is0thenconsidering application responseslaunchapplication"QAutoSaver"endconsideringendifactivateapplication"QAutoSaver"delay0.5-- Without this, triggering the script via a Hot Key doesn't work in Snow Leopard if QAutoSaver is already openkeystrokereturndelay3-- Let you see itactivateapplication"QLab"endtell

Preview selected & move down

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Preview selected and move down (for stepping through cues without waiting for follow-ons) [Hot Key]:

tellapplication"System Events"activateapplication"QLab"delay0.25-- Wait for Double GO Protection to passkeystroke"v"-- The default key to preview a cuekeystroke(ASCII character31)-- Down arrowendtell

Prevent GO while a sound cue is playing

Stephen Swift

A powerful little script which, used carefully, can help prevent disaster in situation where multiple overlapping sound cues would cause trouble.

Label files in use

Sam Kusnetz updated January 17, 2009

This script will let you choose a color label and then label all files in your workspace with that color in the Finder. Useful for tracking down exactly which files are or are not being used in a workspace.

Set color for selected cues

This script allows you to select multiple cues and quickly set the color for all of them.

Notice that there are two colors that are not included in the standard QLab choices. Qlab seems to offer yellow in addition to the familiar orange. And it colors anything that it doesn't recognize as grey - so I made that a choice as well.

This script uses a hack to send plain text OSC to QLab itself. OSC allows you to do things that are either more difficult or - as far as I know, impossible - with AppleScript alone. It works perfectly, even if it is a little less than elegant!

-- DeclarationssetsimpleCasesto{"Start","Stop","Pause","Reset","Load","Goto","Arm","Disarm"}setspecialCasesto{"Fade","Animation","Devamp","Target"}setacceptableTargetsto{"Audio","Video","Audio","Goto"}-- Main routinetellfrontworkspacesetoriginalCuetolastitemof(selectedaslist)setoriginalTypetoqtypeoforiginalCueiforiginalTypeis insimpleCasesthenmoveSelectionUpsettargetCuetolastitemof(selectedaslist)trysetcuetargetoforiginalCuetotargetCuesettargetNametoqnameoftargetCuesetqnameoforiginalCuetooriginalType&": "&targetNameendtrymoveSelectionDownelseiforiginalTypeis inspecialCasesthenrepeatwithifrom1tocountspecialCasesiforiginalTypeisitemiofspecialCasesthensetacceptableTypetoitemiofacceptableTargetsexitrepeatendifendrepeatsetfoundTypeto""setmoveCounterto0repeatwhilefoundTypeis notacceptableTypemoveSelectionUpsetmoveCountertomoveCounter+1settargetCuetolastitemof(selectedaslist)setfoundTypetoqtypeoftargetCueiftargetCueisfirstitemofcuesofcurrentcuelistthen-- Protect against infinite loop if no acceptable target foundexitrepeatendifendrepeatiffoundTypeisacceptableTypethen-- Don't change the target if we've gone all the way up the cue list without finding onesetcuetargetoforiginalCuetotargetCuesettargetNametoqnameoftargetCuesetqnameoforiginalCuetooriginalType&": "&targetNameendifrepeatmoveCountertimesmoveSelectionDownendrepeatendifendtell

Group selected cue(s)

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Put selected cue(s) in a new Group Cue [Hot Key]:

'''WARNING!!!!''' This script will move selected cues out of any Group Cues they are in and into the new Group Cue. If you want a Group Cue to remain intact when it is moved, DO NOT include its children in the selection! Also, remember that new cues are inserted into the cue list after the last cue that was selected (which is not always the same as the cue at the bottom of the selection); this will dictate where the new Group Cue is made, and hence what is moved into it - as the script can't move an existing Group Cue inside the new Group Cue if the new Group Cue is made within the existing Group Cue... The new Group Cue's settings will follow the Workspace Preferences, by the way.

tellfrontworkspacesetselectedCuestoselectedaslistif(countselectedCues)is not0thenmaketype"Group"setgroupCuetolastitemof(selectedaslist)setgroupCueIsIntoparentofgroupCuerepeatwitheachCueinselectedCuesifcontentsofeachCueis notgroupCueIsInthen-- Skip a Group Cue that contains the new Group CueseteachCueIDtouniqueIDofeachCuemovecueideachCueIDofparentofeachCuetoendofgroupCueendifendrepeatendifendtell

Import files

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Choose multiple audio, video and MIDI files and add them to the workspace as new cues; the original files will be copied to the appropriate subfolder next to the workspace, unless they already exist there (in which case the existing files will be used); the script can be adjusted to enforce copying only for non-local files, eg: those on network servers [Hot Key]:

setuserCopyOnImporttotrue-- Set this to false if you do not want the files to be copied to the workspace foldersetuserForceCopyFromNetworktotrue-- Set this to false if you do not want files that aren't on local drives to be copied automaticallysetuserReassuranceThresholdto5-- When the number of files imported is greater than this variable, a "Done" dialog will let you know that the process is complete-- ###BUG TBC### Should audioFileTypes include "public.ulaw-audio"?-- ###BUG TBC### Is videoFileTypes a sufficiently exhaustive list? Are any of the file types not supported by QLab?-- DeclarationsglobaldialogTitle,sharedPathsetdialogTitleto"Import files"setaudioFileTypesto{"com.apple.coreaudio-format","com.microsoft.waveform-audio",¬
"public.aifc-audio","public.aiff-audio","public.audio","public.mp3","public.mpeg-4-audio"}(*Thislistdeliberatelyexcludes"com.apple.protected-mpeg-4-audio"toprotectagainstoldDRM-restrictediTunesfiles*)setvideoFileTypesto{"com.apple.icns","com.apple.macpaint-image","com.apple.pict","com.apple.quicktime-image","com.apple.quicktime-movie",¬
"public.3gpp","public.3gpp2","public.avi","public.camera-raw-image","public.image","public.jpeg","public.jpeg-2000","public.movie","public.mpeg",¬
"public.mpeg-4","public.png","public.tiff","public.video","public.xbitmap-image"}setmidiFileTypesto{"public.midi-audio"}(*cf:http://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html *)settheFileTypesto{audioFileTypes,videoFileTypes,midiFileTypes}setfoldersExistto{null,null,null}settheSubfoldersto{"audio","video","midi file"}settheCueTypesto{"Audio","Video","MIDI File"}-- Main routinetellfrontworkspace-- Establish the path to the current workspacesetworkspacePathtopathifworkspacePathismissingvaluethendisplay dialog"The current workspace has not yet been saved anywhere."withtitledialogTitle¬
withicon0buttons{"OK"}defaultbutton"OK"givingupafter5returnendif-- Get the path that should prefix all media file pathstellapplication"System Events"setsharedPathtopathofcontaineroffileworkspacePathendtell-- Choose the files to importsetnewTargetstochoose fileoftype{"public.image","public.audiovisual-content"}¬
withprompt"Please select one or more audio, video or MIDI files:"withmultipleselectionsallowedwithoutinvisibles-- Import themrepeatwitheachFileinnewTargetstellapplication"System Events"seteachTypetotypeidentifierofeachFileseteachNametonameofeachFileifuserForceCopyFromNetworkistruethen-- Only check file's locality if it will be relevantsetfileIsLocaltolocalvolumeofdisk(volumeofeachFile)elsesetfileIsLocaltotrueendifendtellseteachTargettoeachFile-- This variable will be updated if the file is copied-- Work through the three types of cues that will be processedrepeatwithifrom1to3ifeachTypeis incontentsofitemioftheFileTypesthenif(userCopyOnImportistrue)or(userForceCopyFromNetworkistrueandfileIsLocalisfalse)then-- If copying is specified by the user definitions then…-- Check for appropriate subfolder next to workspace and make it if it doesn't existifitemioffoldersExistisnullthensetitemioffoldersExisttomycheckForFolder(itemioftheSubfolders)ifitemioffoldersExistisfalsethenmymakeFolder(itemioftheSubfolders)endifendif-- If the file is not already in place, copy it to the appropriate subfolderifmycheckForFile(itemioftheSubfolders,eachName)isfalsethenmycopyFile(itemioftheSubfolders,eachFile)endifseteachTargettosharedPath&itemioftheSubfolders&":"&eachNameendif-- Make an appropriate cuemaketypeitemioftheCueTypessetnewCuetolastitemof(selectedaslist)setfiletargetofnewCuetoeachTargetsetqnameofnewCuetoeachNameexitrepeatendifendrepeatendrepeatendtellif(countnewTargets)>userReassuranceThresholdthendisplay dialog"Done."withtitledialogTitlewithicon1buttons{"OK"}defaultbutton"OK"givingupafter5endif-- SubroutinesoncheckForFolder(theSuffix)tellapplication"System Events"returnexistsfolder(sharedPath&theSuffix)endtellendcheckForFolderonmakeFolder(theFolder)tellapplication"Finder"makenewfolderatsharedPathwithproperties{name:theFolder}endtellendmakeFolderoncheckForFile(theSuffix,theName)tellapplication"System Events"returnexistsfile(sharedPath&theSuffix&":"&theName)endtellendcheckForFileoncopyFile(theSuffix,theFile)(*NB:byusingtheFindertheusualfile-copyprogresswindowisinvoked,whichmaybemorereassuringthanthefaceless'do shell script"cp -p "&quoted formofPOSIXpathoftheFile&" "&quoted formofPOSIXpathof(sharedPath&theSuffix&":"&theName)'-whichmaylooklikeafreeze(the-pflagcopieseverypropertyofafile)*)tellapplication"Finder"duplicatetheFiletofolder(sharedPath&theSuffix)endtellendcopyFile

Convert Group Cue

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Convert Group Cues between "fire first go to next cue" sequences (SFX 5.6 style) and "fire all" with independent Pre Waits; IT IS NOT GUARANTEED TO COVER EVERY POSSIBLE SCENARIO SO USE IT '''AT YOUR OWN RISK'''! In particular, it will not work if the children of a "fire all" Group Cue are not in the order in which their Pre Waits will cause them to fire (ie: with each child's Pre Wait greater than or equal to that of the previous child)... [Hot Key]:

Delete

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Delete selected cue(s) including their File Targets (target files will be moved to the Trash):

tellfrontworkspacerepeatwitheachCuein(selectedaslist)tryseteachTargettofiletargetofeachCuetellapplication"Finder"ifPOSIXpathofeachTargetdoes not contain".Trash"thendeleteeachTargetendifendtellendtryseteachCueIDtouniqueIDofeachCuedeletecueideachCueIDofparentofeachCueendrepeatendtell

Arm

Rich Walsh (Last tested with QLab 2.3.4 & Mac OS X 10.6.7)

Create Arm Cue targeting selected cue as previous cue:

tellfrontworkspacesetoriginalCuetolastitemof(selectedaslist)maketype"Arm"setnewCuetolastitemof(selectedaslist)setcuetargetofnewCuetooriginalCuesetqnameofnewCueto"Arm: "&qnameoforiginalCuesetoriginalCueIsIntoparentoforiginalCueifparentofnewCueisoriginalCueIsInthen-- Only reorder the cues if they are in the same group/cue listsetoriginalCueIDtouniqueIDoforiginalCuesetnewCueIDtouniqueIDofnewCuemovecueidoriginalCueIDoforiginalCueIsIntoaftercueidnewCueIDoforiginalCueIsInendifendtell

Using Qlab to generate midi command change cues

This script allows you to create a series of command change cues (With incremental control change values) developed specifically for use on DiGiCo consoles, but will work on any console that accepts midi control change. When paired with a desk macro that creates a desk snapshot whilst triggering this script. It makes programing much quicker

OSC Creator for EOS Consoles

This script creates a custom OSC Message cue that will automatically type the correct syntax for triggering any eos cues. You may elect to use cue lists in the dialog box -- it doesn't care if they are present or not.

--created 6/13/17 by Michael Portrie-- last tested with QLab Version 3.2.10-- mportrie@gmail.com-- Notes: This version has different labeling -- it also inserts "LX xx" into the Q Number field. -- This version also accepts cue lists with no problem. just enter cue list/cue number. if no list, just enter the number. tellapplicationid"com.figure53.qlab.3"totellfrontworkspacedisplay dialog"Create LX Cue - (Cuelist/Cue) - if you arent using cue lists just enter the cue number."buttons{"Create","Cancel"}defaultbutton1defaultanswer""withiconnoteifbutton returnedofresult="cancel"thenreturnelsesetlxnumto(text returnedofresult)as textendifsettheOffsetto(offsetof"/"inlxnum)+1settheLabeltotexttheOffsetthruendoflxnumendtelltellapplication"QLab"setmySeltoselectedofworkspace1setoriginalCuetolastitemofmySeltellworkspace1maketype"OSC"setthecuetolastitemof(selectedaslist)setthepatchofthecueto2-- sets the destination. I default to 2, leaving one open for local addresses. You may change it if you wish. settheoscmessagetypeofthecuetocustomsetthecustommessageofthecueto"/eos/cue/"&lxnum&"/fire/"-- the following 2 lines name and number the cues automatically to match the EOS cue number. -- if you want to skip the auto-naming, delete the first line. -- if you want to skip the auto-numbering, delete the second line.-- if you want to change the prefix, replace "LX" with whatever the prefix you would like is in either line. settheqnameofthecueto"LX "&theLabel-- names the cue based on EOS numbersettheqnumberofthecueto"LX "&theLabel-- numbers the cue based on EOS numberendtellendtell

External scripts

These scripts should all be run from the Script menulet. As they are quite long, they've all got their own pages now...