Selecting Printer in Adobe Illustrator

I’m having a heck of a time getting Illustrator and AppleScript to select the correct printer. Am I doing something wrong?

on printDocument()
	tell application "Adobe Illustrator"
		set theDocument to current document
		tell theDocument
			set printOpts to {print preset:"HOLD"}
			set printerName to "C60-C70-5965_hold"
			set printOpts to {class:print options, printer name:printerName}
			print theDocument options printOpts			
		end tell
	end tell
end printDocument

Hi,

I have not the Illustrator. But, after reading the documentation I see:

the Printer name should be Unicode text (not macRoman)

print options doesn’t exist until you create one new

print document command should be outside of tell document block. So, if this helps (not tested):


on printDocument()
   set printerName to "C60-C70-5965_hold" as Unicode text
   set printPreset to "HOLD" as Unicode text
   tell application "Adobe Illustrator"
set theDocument to current document
set printOpts to make new print options with properties {printer name:printerName, print preset: printPreset}
print theDocument options printOpts 
end tell
end printDocument

NOTE: I am not sure for making new print options using my way, so try the following syntax as well:


set printOpts to {class:print options, printer name:printerName, print preset: printPreset}