Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,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 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[18,281 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 whoever posted them. This site is not responsible for what they say.
Ok ... But ...?
Authored by: macman13 on Oct 11, '02 04:04:22PM

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 Oct 12, '02 03:57:43AM

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 Oct 13, '02 11:23:40AM
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 Oct 13, '02 09:04:01PM

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 Jan 31, '03 04:20:24PM

Answering self. Probably due to GIMP Print.



[ Reply to This | # ]
Print to PDF ?
Authored by: sbq on May 21, '03 05:48:15PM

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 Nov 09, '07 06:51:40AM

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 Jan 27, '09 01:25:50PM
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 | # ]