Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

Use AppleScript to set default printer System
You can use Print Center to designate which printer should be the current (default) printer, which is easy enough. But you may want to do it via AppleScript for automation purposes. If so, here's an example script that will show you all the configured printers, with the current printer highlighted. You can pick a different printer if you want, click OK, and there will be a new current printer.
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
Works on Mac OS X 10.2, not sure about 10.1?
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[12,121 views]  

Use AppleScript to set default printer | 8 comments | Create New Account
Click here to return to the 'Use AppleScript to set default printer' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Ok ... But ...?
Authored by: macman13 on Fri, Oct 11 2002 at 4:04PM PDT
Cool.

But how do you get this to run without popping
up the print center app. It would be cool if this
could switch everything in the background without
having to poop up the print center app?

Thanks.
SA

[ Reply to This | # ]
Working with this idea...
Authored by: kerouassady on Sat, Oct 12 2002 at 3:57AM PDT
So if I made a bunch of scripts that corresponded with each of my printers specifically and put them in the script menu, I could end up with a menu extra like the old Desktop Printer Menu that I loved in OS9. Like the previous post, ideally you'd want it to happen in the background and not launch any application. I know this isn't really necessary, given that you can change your printer directly from the print dialog, but it would be nice. And theoretically, you could write an applescript installer that would read your currently installed printers and generate the individual scripts and name them.

[ Reply to This | # ]
auto-quit
Authored by: RichB on Sun, Oct 13 2002 at 11:23AM PDT
By adding these lines to the script it gets rid of Print Center after the choice is made:

tell application "Print Center"
quit
end tell


[ Reply to This | # ]
Print to PDF ?
Authored by: MtnBiker on Sun, Oct 13 2002 at 9:04PM PDT
Can print to PDF be added? I used to have a couple of QuicKeys to select either my printer or PDF. Now using DragThing, which if there where a print to PDF method, I could use to select whichever printer I wanted with just keystrokes.

PS Off Topic: Why do I now have two different Epson Printer selections for my 740?

One is called "SC 740(USB)" and the other "Stylus COLOR 740." i believe the former came with Jaguar and the other pre-Jaguar.

[ Reply to This | # ]
Print to PDF ?
Authored by: MtnBiker on Fri, Jan 31 2003 at 4:20PM PST
Answering self. Probably due to GIMP Print.

[ Reply to This | # ]
Print to PDF ?
Authored by: sbq on Wed, May 21 2003 at 5:48PM PDT
Did you ever get a response to the posting you made (reproduced below?) I am interested in exactly the same question.

Regards,
Sam Quiring

Print to PDF ?
Authored by: MtnBiker on Sun, Oct 13 '02 at 09:04PM
Can print to PDF be added? I used to have a couple of QuicKeys to select either my printer or PDF. Now using DragThing, which if there where a print to PDF method, I could use to select whichever printer I wanted with just keystrokes.



[ Reply to This | # ]
Use AppleScript to set default printer
Authored by: rybu0305 on Fri, Nov 9 2007 at 6:51AM PST
This doesn't work in Leopard. Does anyone have an updated script that works with 10.5?

[ Reply to This | # ]
Use AppleScript to set default printer
Authored by: Vincent Gable on Tue, Jan 27 2009 at 1:25PM PST
This woks for me in in Leopard,
tell application "Printer Setup Utility"
   set printerlist to name of printers
   set oldprinter to name of current printer
end tell
set printerchoice to (choose from list printerlist with prompt ¬
   "Which printer to be default?" default items oldprinter)
set myprinter to printer(printerchoice as string)
tell application "Printer Setup Utility" to set current printer to myprinter

You might also be interested in IMLocation, it can change your default printer for you automatically, based on if you are at home, work, etc. It includes an Automator to set the default printer, which you can use in any workflow.

[ Reply to This | # ]