• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Script Utilizing an Alternate Printer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script Utilizing an Alternate Printer


  • Subject: Re: Script Utilizing an Alternate Printer
  • From: Shane Stanley <email@hidden>
  • Date: Tue, 11 Aug 2015 09:39:18 +1000

On 11 Aug 2015, at 4:26 am, Jonathan Levi <email@hidden> wrote:

is there a way to reset the default printer?

Assuming you're running Mavericks or later, try this:

use AppleScript version "2.3"
use scripting additions
use framework "Foundation"
use framework "AppKit"

set theNames to current application's NSPrinter's printerNames() as list
set printerName to (choose from list theNames with prompt "Choose a printer:")
if printerName = false then error number -128
set thePrinter to current application's NSPrinter's printerWithName:(item 1 of printerName)
set thePrintInfo to current application's NSPrintInfo's sharedPrintInfo()
thePrintInfo's setPrinter:thePrinter


You'll need to call it from a script library in Mavericks.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Script Utilizing an Alternate Printer (From: Jonathan Levi <email@hidden>)

  • Prev by Date: Script Utilizing an Alternate Printer
  • Next by Date: Yosemite Mail — New Message from Template
  • Previous by thread: Script Utilizing an Alternate Printer
  • Next by thread: Yosemite Mail — New Message from Template
  • Index(es):
    • Date
    • Thread