Re: Choosing Printer
Re: Choosing Printer
- Subject: Re: Choosing Printer
- From: Jean-Marie Hoornaert <email@hidden>
- Date: Wed, 06 Jun 2001 15:59:32 +0200
le 6/06/2001 12:51, Alberto Salvagnini a icrit :
>
My problem: I did not find a way to change (choose) the printer in the
>
"Chooser"-Application of the finder
>
Some suggestions?
Here a script I'm using in "Outlook Express", "Entourage" and other
attachable applications.
This script use the "set printer to" scripting addition to select a printer
whose not a desktop printer.
So you can select any printer: Desktop printer and others ("Print2pict" or
"Faxprint" for example).
try
set default_printer to ""
set chemin_extensions to (path to the extensions)
tell application "Finder"
set chooser_printer_list to the name of ,
(every file of chemin_extensions ,
whose file type is in {"PRER", "PRES"}) as list
end tell
tell application "Desktop Printer Manager"
set the driver_list to the driver name of every desktop printer
set the desktop_printer_list to the name of every desktop printer
try
set the default_printer to the name of the default printer
end try
end tell
set printer_list to {}
repeat with i in chooser_printer_list
if not (driver_list contains i) then
set printer_list to (printer_list & i) as list
end if
end repeat
set printer_list to (printer_list & desktop_printer_list) as list
set message_ to "Select a printer"
if default_printer is not "" then
set message_ to message_ & return & "Current printer: " & ,
default_printer
end if
set DTP_name to choose from list printer_list ,
with prompt message_ without multiple selections allowed
if DTP_name is not false then
if desktop_printer_list contains DTP_name then
tell application "Desktop Printer Manager"
set the default printer to desktop printer ,
(item 1 of DTP_name)
end tell
else
(set printer to DTP_name) -- OSAX "set printer to"
end if
end if
return
on error error_text number error_number
display dialog "Error : " & error_text & " numiro " & error_number & ,
"Be sure \"Set printer to\"" & ,
" is in the scripting additions folder. " ,
buttons {"OK"} default button 1 with icon +constant Altp;
end try
return
--
Jean-Marie -HOO;-)
____________________
Jean-Marie Hoornaert
email@hidden
http://www.h2o.be
AppleScripting FileMaker
French web site