Re: Choose Desktop Printer
Re: Choose Desktop Printer
- Subject: Re: Choose Desktop Printer
- From: Shane Stanley <email@hidden>
- Date: Thu, 26 Jul 2001 16:47:48 +1000
On 26/7/01 4:10 PM +1000, Bart Visser, email@hidden, wrote:
>
I'm writing a script that makes it posible for a user to select a
>
desktopprinter from a list. But when I run the script I get an error that
>
say's something like: Desktop Printer Manager Error, no user interaction
>
allod. (In dutch so I don't know the exact words). Is there an other way to
>
do this or to turn user-interaction on?
The problem is that your asking Desktop Printer Manager to display the
choose from list dialog, but as a faceless application it can't do that. So
you have to move the dialog outside the "tell app..." part, something like
this:
tell application "Desktop Printer Manager"
set allPrinters to name of desktop printers
set defaultPrinter to name of default printer
end tell
set newPrinter to (choose from list allPrinters default items
{defaultPrinter})
tell application "Desktop Printer Manager"
set default printer to desktop printer (item 1 of newPrinter)
end tell
--
Shane Stanley, email@hidden