Re: Script Utilizing an Alternate Printer
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.
|
_______________________________________________
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