QLab Scripts

This is a selection of scripts written by Tyler A. Berg for use with either QLab or Apple Computer basic functions.

You can also check out the Applescript for Technical Theatre GitHub Page, made by Tyler A. Berg.

Make Fade In Cue (with Time Prompt)

                        
set durationMessage to "How many seconds should this fade be?"
set theResponse to display dialog durationMessage default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"

set inDuration to text returned of theResponse
set minVolume to -60
set nominalVolume to 0
tell application id "com.figure53.QLab.5" to tell front workspace
    try
        set audioCue to last item of (selected as list)
        set newQNumber to q number of audioCue
        set q number of audioCue to ""
        if q type of audioCue is "Audio" then
            make type "Fade"
            set fadeInCue to last item of (selected as list)
            set cue target of fadeInCue to audioCue
            set duration of fadeInCue to inDuration
            fadeInCue setLevel row 0 column 0 db nominalVolume
            set q name of fadeInCue to "Fade In " & q list name of audioCue
            audioCue setLevel row 0 column 0 db minVolume
            set cuesToGroup to {audioCue, fadeInCue}
            make type "Group"
            set groupCue to last item of (selected as list)
            set mode of groupCue to fire_all
            set q name of groupCue to q list name of audioCue
            set q number of groupCue to newQNumber
            repeat with eachCue in cuesToGroup
                set eachCueID to uniqueID of eachCue
                move cue id eachCueID of parent of eachCue to end of groupCue
            end repeat
        end if
    end try
end tell                        
                            
                    

Make Fade Out and Stop Cue List (with Time Prompt)

                        
set durationMessage to "How many seconds should this fade be?"
set theResponse to display dialog durationMessage default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"

set outDuration to text returned of theResponse
set minVolume to -60
set nominalVolume to 0

tell application id "com.figure53.Qlab.5" to tell front workspace
    try
        set audioCue to last item of (selected as list)
        if q type of audioCue is "Audio" then
            make type "Fade"
            set fadeOutCue to last item of (selected as list)
            -- set the q number of the fadeOutCue to q number of audioCue & "x"
            set cue target of fadeOutCue to audioCue
            set duration of fadeOutCue to outDuration
            fadeOutCue setLevel row 0 column 0 db minVolume
            set stop target when done of fadeOutCue to true
            set q name of fadeOutCue to "Fade Out and Stop " & q list name of audioCue
        end if
        if q type of audioCue is "Group" then
            make type "Fade"
            set fadeOutCue to last item of (selected as list)
            set the q number of the fadeOutCue to q number of audioCue & "x"
            set cue target of fadeOutCue to audioCue
            set duration of fadeOutCue to outDuration
            fadeOutCue setLevel row 0 column 0 db minVolume
            set stop target when done of fadeOutCue to true
            set q name of fadeOutCue to "Fade Out and Stop " & q list name of audioCue
        end if
    end try
end tell
                            
                    

Show Time Selector for American Players Theatre 2024 Rep Season

                        
set myTimes to {"10:00", "10:30", "13:00", "14:00", "18:00", "19:30", "20:00", "DISARM ALL"}

tell application "System Events"
    set theDate to (current date)
    set theDay to weekday of theDate
    set theHour to (hours) of theDate
end tell

set horns1000 to "H1000"
set horns1030 to "H1030"
set horns1300 to "H1300"
set horns1400 to "H1400"
set horns1800 to "H1800"
set horns1930 to "H1930"
set horns2000 to "H2000"


try
    tell application id "com.figure53.Qlab.5" to tell front workspace
        
        set selectedTime to (choose from list myTimes with title "Show Time Selector" with prompt "What time is the show at today?" default items "DISARM ALL")
        
        
        if selectedTime is {"10:00"} then
            set armed of cue horns1000 to true
            set armed of cue horns1030 to false
            set armed of cue horns1300 to false
            set armed of cue horns1400 to false
            set armed of cue horns1800 to false
            set armed of cue horns1930 to false
            set armed of cue horns2000 to false
            
        else if selectedTime is {"10:30"} then
            set armed of cue horns1000 to false
            set armed of cue horns1030 to true
            set armed of cue horns1300 to false
            set armed of cue horns1400 to false
            set armed of cue horns1800 to false
            set armed of cue horns1930 to false
            set armed of cue horns2000 to false
            
        else if selectedTime is {"10:30"} then
            set armed of cue horns1000 to false
            set armed of cue horns1030 to true
            set armed of cue horns1300 to false
            set armed of cue horns1400 to false
            set armed of cue horns1800 to false
            set armed of cue horns1930 to false
            set armed of cue horns2000 to false
            
        else if selectedTime is {"13:00"} then
            set armed of cue horns1000 to false
            set armed of cue horns1030 to false
            set armed of cue horns1300 to true
            set armed of cue horns1400 to false
            set armed of cue horns1800 to false
            set armed of cue horns1930 to false
            set armed of cue horns2000 to false
            
        else if selectedTime is {"14:00"} then
            set armed of cue horns1000 to false
            set armed of cue horns1030 to false
            set armed of cue horns1300 to false
            set armed of cue horns1400 to true
            set armed of cue horns1800 to false
            set armed of cue horns1930 to false
            set armed of cue horns2000 to false
            
        else if selectedTime is {"18:00"} then
            set armed of cue horns1000 to false
            set armed of cue horns1030 to false
            set armed of cue horns1300 to false
            set armed of cue horns1400 to false
            set armed of cue horns1800 to true
            set armed of cue horns1930 to false
            set armed of cue horns2000 to false
            
        else if selectedTime is {"19:30"} then
            set armed of cue horns1000 to false
            set armed of cue horns1030 to false
            set armed of cue horns1300 to false
            set armed of cue horns1400 to false
            set armed of cue horns1800 to false
            set armed of cue horns1930 to true
            set armed of cue horns2000 to false
            
        else if selectedTime is {"20:00"} then
            set armed of cue horns1000 to false
            set armed of cue horns1030 to false
            set armed of cue horns1300 to false
            set armed of cue horns1400 to false
            set armed of cue horns1800 to false
            set armed of cue horns1930 to false
            set armed of cue horns2000 to true
            
        else if selectedTime is {"DISARM ALL"} then
            set armed of cue horns1000 to false
            set armed of cue horns1030 to false
            set armed of cue horns1300 to false
            set armed of cue horns1400 to false
            set armed of cue horns1800 to false
            set armed of cue horns1930 to false
            set armed of cue horns2000 to false
        end if
        
        
    end tell
end try

try
    tell application id "com.figure53.Qlab.5" to tell front workspace
        set heatWarningMsg to "Is there a heat warning today? Please double-check with the Stage Manager."
        set question to display dialog heatWarningMsg with title "HEAT WARNING SELECTOR" with icon 1 buttons {"Yes", "No"} default button "No"
        
        if button returned of question is "Yes" then
            start cue "AHW"
        else if button returned of question is "No" then
            start cue "DHW"
        end if
        
    end tell
end try                            
                            
                    

Speaker Check Sequence Setup

                        
set spkcheckTitle to "SPEAKER CHECK SETUP"
set audioFileCueMsg to "What is the cue number of the audio file being used for Sound Check?"
set numChansMsg to "How many channels do you need to check? [##]"

set startingLevel to -10
set offLevel to -100

set fadeTime to 1


tell application id "com.figure53.qlab.5" to tell front workspace
	
	set sourceCue to cue "A"
	set chanCount to display dialog numChansMsg default answer "" with title spkcheckTitle with icon note buttons {"Cancel", "Ok"} default button "Ok"
	
	repeat with i from 1 to (text returned of chanCount)
		make type "Fade"
		set newCue to last item of (selected as list)
		set cue target of newCue to sourceCue
		set q number of newCue to ("B" & "." & i)
		set duration of newCue to fadeTime
		repeat with h from 1 to (text returned of chanCount)
			newCue setLevel row 0 column h db offLevel
		end repeat
		newCue setLevel row 0 column i db startingLevel
	end repeat
	
	make type "Fade"
	set newCue to last item of (selected as list)
	set cue target of newCue to sourceCue
	set q number of newCue to ("C.1")
	set q name of newCue to "STOP SPEAKER CHECK"
	set duration of newCue to fadeTime
	set q color of newCue to "Orange"
	repeat with h from 1 to (text returned of chanCount)
		newCue setLevel row 0 column h db offLevel
	end repeat
	
	make type "Fade"
	set newCue to last item of (selected as list)
	set cue target of newCue to sourceCue
	set q number of newCue to ("C.2")
	set q name of newCue to "STOP SPEAKER CHECK"
	set stop target when done of newCue to true
	set duration of newCue to fadeTime
	set q color of newCue to "Red"
	repeat with h from 1 to (text returned of chanCount)
		newCue setLevel row 0 column h db offLevel
	end repeat
	
end tell
                            
                    

Open a Minimized Web Browser Window and Make it Fullscrreen

                        
tell application "Google Chrome"
	activate
	delay 0.5
	
	set minimized of window 1 to false
	
	delay 0.5
	
	tell application "Google Chrome" to tell the active tab of its first window
		reload
	end tell
	
	delay 0.5
	
	tell application "System Events" to tell process "Google Chrome"
		set value of attribute "AXFullScreen" of window 1 to true
	end tell
end tell


                            
                    

Exit Fullscreen of a Web Browser and Minimize (Return to QLab)

                        
tell application "Google Chrome"
    activate
end tell
delay 0.5

tell application "Google Chrome" to tell the active tab of its first window
    reload
end tell
delay 0.5


tell application "Google Chrome"
    activate
    
    delay 0.25
    
    tell application "System Events" to tell process "Google Chrome"
        set value of attribute "AXFullScreen" of window 1 to false
    end tell
    
    delay 0.5
end tell

tell application "Google Chrome"
    activate
    
    delay 0.5
    set minimized of window 1 to true
end tell

delay 0.5

tell application "QLab" to activate