Posts RSS Comments RSS 48 Posts and 155 Comments till now

Using AppleScript to set the default printer

Here’s a simple little script that you can use to reset which printer is listed as default. You can set it up as a Login Item and have it run every time you log in to reset the default printer.

Get the name of the printer you want from Printer Setup Utility. You want the actual name displayed in the Printer Setup Window.

In AppleScript the term “current printer” refers to the currently selected printer, which is always the current default printer.

After you have the name place in this script, replacing the words “Epson Inkjet Printer”.

Download the compiled script here:
Default Printer Script

[codesyntax lang=”applescript” lines=”no”]
tell application “Printer Setup Utility”
set the_printer to the current printer
set the_name to the name of the_printer
if the_name is not “Epson Inkjet Printer” then
set the_count to the count of printers
repeat with x from 1 to the_count
if the name of printer x is “Epson Inkjet Printer” then
set the current printer to printer x
end if
end repeat
end if
quit
end tell
[/codesyntax]

The script gets the name of the current default printer. Then it loops through all the printers in the list looking for the name of the one you want. When the script comes to that name it sets it to be the current printer. Calling Printer Setup Utility in a script always launches it so I put a “quit” statement at the end so we don’t have Printer Setup Utility running afterwards.

Comments are closed.