Coding for QLab

AppleScript Tricks for QLab

Printing a document on a remote machine – in a production of The Memorandum, there were multiple points in the show where characters appeared to print a document from their prop computers. By using the following AppleScript code, I could print specific files located on the show computer to a connected printer (a Brother laser jet connected via a USB over Ethernet extender, in this instance) without displaying the printer dialog window. Check the “run in separate process” box.

1
2
3
4
5
6
7
set theFile to (POSIX file "/path/to/your/file")  --  the file path within the user account, including file extension. Adjust as necessary
 
tell application "printerSoftware"  --  the control application for your connected printer. Adjust as necessary.
activate
print theFile without «class pdlg»  --  this prevents the dialog box from appearing
quit
end tell

Remote Voices – I once did a show in which a laptop on stage needed to beep, ding and generate the Apple voice assistant sounds, all while in motion across the stage. Since there wasn’t a place to hide a speaker with the machine in constant motion, I used the eppc protocol supported by Apple Remote Events (System Preferences>Sharing) and the following script. The laptop could be tethered via Ethernet, or on the same Wi-Fi show network as the QLab machine (always used closed networks for show systems).

1
2
3
4
5
6
7
8
9
set remoteFinder to application "Finder" of machine "eppc://user:pass@IP_address"  --  set the user name, password and IP address of the target machine
 
using terms from application "Finder"
	tell remoteFinder
		tell application file id "com.apple.SystemEvents"
			say "Hello Dave. It’s nice to see you today"
		end tell
	end tell
end using terms from

Remote Application Control – Building on the technique above, you can use this script to remotely open an application on a target machine and launch a file:

1
2
3
4
5
6
7
8
9
10
11
12
set remoteFinder to application "Finder" of machine "eppc://user:pass@IP_Address"  --  set the user name, password and IP address of the target machine
 
using terms from application "Finder"
	tell remoteFinder
		open application file id "com.apple.iTunes"
		delay 1
		tell remoteFinder
			set theFile to POSIX file "/path/to/your/file"  --  adjust this to the path of your file, including file extension
			open theFile using application file id "com.apple.iTunes"
		end tell
	end tell
end using terms from

HoganSound