Search
  • Taylor Glad

Renumber Selected Cues with a Prefix

Explanation

Renumber selected cues using a prefix. Works similar to QLab's built-in renumbering system, but first prompts the user for a prefix.

Great if your stage manager wants all the audio cues to be A1, A2, A3, etc. or if you have multiple screens and want cues to be numbered S1_1, S1_2, S1_3, etc.

The script works around existing cue numbers, and just skips those numbers.



Script

Copy the text to the right, and paste it into a script cue in your QLab workspace.

I recommend assigning it a hotkey, or I like to give each script cue a unique cue number using letters, and then trigger it from Bitfocus Companion.



--Renumber selected cues using a prefix. Works similar to QLab's built-in renumbering system, but first prompts the user for a prefix.
--Great if your stage manager wants all the audio cues to be A1, A2, A3, etc. or if you have multiple screens and want cues to be numbered S1_1, S1_2, S1_3, etc.
--Taylor Glad

--Global Variables
set selectedCues to ""
set qString to ""
set qNumber to ""
set qIncrement to 1

tell application id "com.figure53.QLab.4" to tell front workspace
	set selectedCues to selected as list
	display dialog "Enter letter/string (no spaces)" default answer "" with title "Renumber with Letters" with icon 1
	set qString to text returned of result as string
	
end tell

AskStart()
on AskStart()
	tell application id "com.figure53.QLab.4" to tell front workspace
		display dialog "Start at" default answer "" with title "Renumber with String" with icon 1
	end tell
	try
		set qNumber to text returned of result as number
		return qNumber
	on error
		tell application id "com.figure53.QLab.4" to tell front workspace
			display dialog "That is not a number" with title "Renumber with String" with icon 2
		end tell
		AskStart()
	end try
	
end AskStart
set qNumber to result

AskInc()
on AskInc()
	tell application id "com.figure53.QLab.4" to tell front workspace
		display dialog "increment by" default answer "1" with title "Renumber with String" with icon 1
	end tell
	try
		set qIncrement to text returned of result as number
		return qIncrement
	on error
		tell application id "com.figure53.QLab.4" to tell front workspace
			display dialog "That is not a number" with title "Renumber with String" with icon 2
		end tell
		AskInc()
	end try
end AskInc
set qIncrement to result

RenumberCue(selectedCues, qString, qNumber, qIncrement)
on RenumberCue(selectedCues, qString, qNumber, qIncrement)
	tell application id "com.figure53.QLab.4" to tell front workspace
		repeat with eachCue in selectedCues
			set the q number of eachCue to ""
		end repeat
		--Removes the existing Cue Numbers
		
		set qNumber to qNumber - qIncrement
		--subtracts one increment, so that the first cue in the loop doesn't start one increment higher than specified
		
		repeat with eachCue in selectedCues
			
			repeat until q number of eachCue is qString & qNumber
				
				set qNumber to qNumber + qIncrement
				set the q number of eachCue to qString & qNumber
				
			end repeat
			
			if (qNumber mod 1 is 0.0) then set qNumber to qNumber div 1
			--Removes the .0 from whole numbers
			
		end repeat
	end tell
end RenumberCue

11 views0 comments

Recent Posts

See All