How do I script the Chooser?

Much to the dismay of many, the Chooser is not scriptable. But thanks to scripting additions, there is a way to work around it. Look into the freeware SÃ?¤ndi’s Additions, which includes the command “type text” and allows simulated typing on the keyboard.

Suppose you wanted to choose a printer named “LaserWriter Select 360” in the Chooser.

tell application "Finder"
	open file ((path to apple menu items folder as text) & "Chooser")
	type text "L" -- selects the LaserWriter 8 icon
	type text tab -- move to the printer choices
	type text "LaserWriter Select 360 " -- selects the driver
	type text "q" holding down command -- quit the Chooser
	type text return -- to okay the choice
end tell

The printer has been chosen!