OSX Printer Selection

Has anybody have any ideas on how to select different printers using applescript in OSX? I have seen many posts about this topic but no responses.

I have only one printer, so I can’t experiment much. Anyhow this code returns the name of my printer.

tell application "Print Center"
	get current printer
end tell
-->printer "DESKJET 840C" of application "Print Center"

Maybe that can get you started.

I found this on the net, and redid some of it. I have seen it fail when being used with ARD.


tell application "Print Center"
	set printerlist to name of printers
	set oldprinter to name of current printer
	set printerchoice to (choose from list printerlist with prompt ¬
		"Which printer to be default?" default items oldprinter)
	set myprinter to printer (printerchoice as string)
	set current printer to myprinter
end tell

that will give you a list of printers and let you choose the one you want.
i wrote this one which allows you to set the default printer by name (also fails with ARD)


tell application "Print Center"
	activate
	set current printer to printer ("PrinterName" as string)
	quit
end tell

that should give you a good idea of what the print center scripting tools do.

cool script
but i don’t know its with me or with you too

after I run the script it select the default printer but the quit command is creating problem.

after the print center quit it send 6 to 7 untitled document to the print center to print. I don’t know whats that.

Any more thoughts on this thread?

telling the Print Center to “set current printer to HP LaserJet 4” simply tells the Print Center to set the default printer to that particular printer. it doesn’t solve the problem, however, of changing the CURRENT printer to something other than whatever printer was used by the last program that printed something. it doesn’t seem that individual application script dictionaries are any help. for example, in Excel, there doesn’t seem to be any option to tell the application which printer to send a job to.

another thing that confuses me then is what is the usefulness of being able to change the default printer in the print center to a particular printer if that “default” setting doesn’t seem to mean anything to other applications?