RE: Scripting the Chooser
RE: Scripting the Chooser
- Subject: RE: Scripting the Chooser
- From: Hellum Timothy <email@hidden>
- Date: Wed, 21 Feb 2001 13:28:07 -0500
Hi Barry,
Thanks for replying...
I keep getting the alert thrown up that I haven't got the "Set Printer To"
addition installed when running the script, which I do. I've rebuilt the
desktop, to no avail in this scenario. And since I'm thinking about it
again, I'd like to add the functionality of clicking the "Transfer" button
and adding a default transfer curve.
Seems like a lot to ask a script to do. This isn't too important an issue
for me. Just trying to alleviate some tedium in hitting the same sequence
of actions time and again.
Thank you for pointing me at Print Choice CDEV. I have installed it on a
couple of other machines now and will Beta it for awhile to see how it fits
in. In the meantime, it was very interesting to poke around in the PPD with
BBEdit anyway. Saw a few things that made me go "hmmm."
Timothy
Photodesk
The Globe and Mail
www.globeandmail.ca
(416) 585-5375
_______________________________
Once again the thought strikes me:
Even half is quite a bit of wit.
~ Tom Waits
>
----------
>
From: B2 Fass-Holmes
>
Reply To: B2 Fass-Holmes
>
Sent: Wednesday, February 21, 2001 10:53 AM
>
To: Hellum Timothy
>
Subject: RE: Scripting the Chooser
>
>
<<File: Print Choice menu>>
>
Reply to: RE: Scripting the Chooser
>
Hi Tim!
>
>
Thanks for taking time to reply.
>
>
>
I regret that you've experienced problems, but you did not mention what
>
the specific symptom was. What did not work? Exactly what happened when
>
you tried to compile the script? Run it? If you let me know, I may be able
>
to help you out.
>
>
BTW: you did not need to edit the PPD's to change the default paper size.
>
In the Page Setup dialog, set the paper size you want. Then press the
>
Option key when you click the dialog's Save button. An alert will display
>
asking if you want to change the default setting. Click OK, and it's a
>
done deal!
>
>
Have you tried out Print Choice? To reiterate from my previous message,
>
ftp://ftp.amug.org/amug-files/system/p-q/printchoice-1.4.sit.hqx
>
>
I suspect that using Print Choice to change printers will work faster than
>
running an Apple Script, even on the fastest G4s! All you have to do with
>
Print Choice is select the desired printer from the menu in the Menu Bar
>
at the top of your monitor. Best of all, it is available as freeware!
>
>
I have taken the liberty of attaching a small screen-capture file showing
>
you Print Choice's menu.
>
Cheers!
>
>
Barry
>
>
Hellum Timothy wrote:
>
> Hi Barry,
>
>
>
> Actually, I was premature in posting that things were working well on
>
the
>
>chooser scripting front. The suggestions posted here actually didn't
>
work
>
>out at my end. What I did, in the end, to avoid having "Letter (small)"
>
>come up as the default selection in the paper size pop-down was resort to
>
>editing postscript information. I opened the PPD (printer description
>
file,
>
>located in the Printer Descriptions folder in the Extensions folder) of
>
the
>
>two printers I send to in BBEdit. I then scrolled through each PPD and
>
>simply deleted the line references that had "(small)" in them (there were
>
>six or so lines in each PPD I think). I resaved the PPDs as copies and
>
then
>
>selected them as my PPD of choice in the Chooser (by double-clicking on
>
the
>
>printer icon and manually selecting my new PPD).
>
>
>
> As far as scripting the booleans (Captioning and Labels) and rotating
>
the
>
>image, no progress since I was unable to get the supplied suggestions to
>
>work (surely my own shortcomings with Applescript - I am a newbie).
>
>
>
> For what its worth, here is what I ended up giving up on:
>
> (with thanks and apologies for not getting it to work to Jean-Marie
>
>Hoornaert)
>
>
>
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
>
>
>
>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 "Choose 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
>
> tell me to quit -- if save as applet
>
>on error error_text number error_number
>
> display dialog "An error occured." & return & ,
>
> "Error : " & error_text & " Number " & error_number & ,
>
> "Make sure the Scripting Addition \"Set printer to\" " & ,
>
> "is present. " buttons {"OK"} default button 1 with icon
>
caution
>
>end try
>
>tell me to quit -- if save as applet
>
>
>
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
>
>
>
>Photodesk
>
>The Globe and Mail
>
>www.globeandmail.ca
>
>(416) 585-5375
>
>_______________________________
>
>Once again the thought strikes me:
>
>Even half is quite a bit of wit.
>
>~ Tom Waits
>
>
>
>> ----------
>
>> From: B2 Fass-Holmes
>
>> Reply To: B2 Fass-Holmes
>
>> Sent: Monday, February 19, 2001 8:33 PM
>
>> To: THellum
>
>> Subject: Scripting the Chooser
>
>> >> >Although Canadian, my French is (plus regrettable) barely adequate.
>
>> However, I think I can puzzle through the
>
>> >syntax (verbal, that is!). Actually, I was pleased to see an error pop
>
up
>
>> in French. I may just tuck in some
>
>> >French in other scripts to see if my fellow Canadians are awake during
>
>> script runs! ha!
>
>> >> Hi Tim!
>
>> >> Would you be willing to send me your anglicized version of
>
Jean-Marie's
>
>> script? I am unable to compile the original script successfully. It
>
poops
>
>> out on the line
>
>> >> set chooser_printer_list to the name of ,
>
>> >> The error is >> Expected expression but found ","
>
>> >> Do you know how to change the page orientation (from portrait to
>
>> landscape, or vice versa) using AS without going to the Page Setup
>
dialog?
>
>> >> Many thanks!
>
>> >> Barry F-H
>
>> >> P.S. I have been using the Print Choice control panel for switching
>
>> between printers without going to the Chooser. Print Choice used to be
>
a
>
>> shareware program, but for whatever reason it has been available for
>
free
>
>> and has not been updated since 1995
>
>> (ftp://ftp.amug.org/amug-files/system/p-q/printchoice-1.4.sit.hqx ). >>
>
It works fine with MacOS 9.0.4 in my experience.
>
>> >> >> >> >
>
>
>
>RFC822 header
>
>-----------------------------------
>
>
>
> Received: from hub.tg.globeandmail.ca (node20net69.globeandmail.ca
>
>[199.246.69.20])
>
> by hummingbird.prod.itd.earthlink.net (8.9.3-EL_1_3/8.9.3) with SMTP
>
id >JAA28793
>
> for <email@hidden>; Tue, 20 Feb 2001 09:47:07 -0800 (PST)
>
> Received: from
>
>judy.globeandmail.ca(node5net65.globeandmail.ca[199.246.65.5]) (5592
>
bytes) by >hub.tg.globeandmail.ca
>
> via sendmail with P:smtp/R:inet_hosts/T:smtp
>
> (sender: <email@hidden>) > id
>
<email@hidden>
>
> for <email@hidden>; Tue, 20 Feb 2001 12:47:06 -0500 (EST)
>
> (Smail-3.2.0.101 1997-Dec-17 #5 built 1998-March-10)
>
> Received: from 199.246.64.113 by judy.globeandmail.ca (InterScan E-Mail
>
>VirusWall NT); Tue, 20 Feb 2001 12:47:05 -0500 (Eastern Standard Time)
>
> Received: by torobrg01.globeandmail.ca with Internet Mail Service
>
(5.5.2448.0)
>
> id <1PRXZZ1S>; Tue, 20 Feb 2001 12:47:04 -0500
>
> Message-ID:
>
><email@hidden>
>
> From: Hellum Timothy <email@hidden>
>
> To: Hellum Timothy <email@hidden>,
>
> "'B2 Fass-Holmes'"
>
> <email@hidden>
>
> Subject: RE: Scripting the Chooser
>
> Date: Tue, 20 Feb 2001 12:46:54 -0500
>
> MIME-Version: 1.0
>
> X-Mailer: Internet Mail Service (5.5.2448.0)
>
> Content-Type: text/plain;
>
> charset="iso-8859-1"
>
> Content-Transfer-Encoding: 8bit
>
> X-MIME-Autoconverted: from quoted-printable to 8bit by
>
>hummingbird.prod.itd.earthlink.net id JAA28793
>
> X-UIDL: 7a72f1d418636a937939668b47bef249