[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Getting started with Applescript & Perl



>I now have MacPerl 5.0.7 installed and Applescript. What I
>would like to do from MacPerl is to tell GraphicsConverter
>to open a specific file, or Netscape to open a file or
>URL. Is this hard to do in Applescript?

I don't think GraphicsConverter is scriptable. I use Debabelizer from
Equilibrium to batch-convert graphics files, and Debabelizer is scriptable.
You can even control it from AppleScript, after a fashion.  Debabelizer
has its own peculiar scripting mechanism, and does not support the Object
Model (shame on you, Equilibrium!).  However, you can record actions in
Debab's scripting language and then export the script as an AppleScript.
It's ugly, but it does work.

>Is there an archive of sample MacPerl/Applescript programs?

I recommend ScriptWeb as a good starting place:
http://www.scriptweb.com/scriptweb/

>Maybe I should buy a book on Applescript. What books do you
>recommend? I've seen a book titled "The Tao of Applescript"?

There are two good third-party books on AppleScript, and you should read
them in this order:

The Tao of AppleScript, 2nd Edition, by Derrick Schneider (Hayden Books)
Danny Goodman's AppleScript Handbook, 2nd Edition, by Danny Goodman (Random
House)

The Tao is pitched at beginning scripters, and is highly didactic.  Danny
Goodman's book is drier, but ultimately more informative.  You will also
need to get the Apple books on AppleScript once you're comfortable with
scripting.  The essentials include:

AppleScript Language Guide: English Dialect
AppleScript Scripting Additions Guide: English Dialect
AppleScript Finder Guide (if you want to script the Finder)

You should also consider buying Script Debugger, which is a terrific
alternative script editor.  Script Debugger supports stepwise debugging,
variable watching (to the limited extent provided by this iteration of
AppleScript), and a host of other convenient features.  I strongly
recommend Script Debugger.

There are a couple of other books on AppleScript, including "Applied Mac
Scripting" and "AppleScript for Dummies".  I haven't really looked at
either one, though Applied Mac Scripting contains a long section on
Frontier, which a lot of programmers prefer to AppleScript.

You might want to consider learning Frontier as an alternative to
AppleScript.  Because AppleScript is verbose and not particularly fast, it
is often perceived as lacking power.  I find it useful, though limited in
many ways.  Frontier, on the other hand, is extremely powerful and very
fast, though it is unnecessarily obscure.  Its scripting language is
similar to that of the C programming language, with some bizarre
modifications.  It is not well-suited for non-programmers.

To tell you the truth, even though I am reasonably well-versed in Pascal
and C, I do not find Frontier particularly pleasant to work with.  On the
other hand, it is extremely powerful, and the current freeware version of
Frontier is many times faster than AppleScript.  If you need to develop
industrial-strength scripts, Frontier is (unfortunately) the only way to
go.  Maybe Apple will turbocharge AppleScript when Copland ships.  I
wouldn't hold my breath, though.

All the best,



Jeff Johnson

----------------------------------------------------------------------
Macintosh Services Technologist                          Synopsys, Inc.
Computing Systems                            700 East Middlefield Road
Network & Computing Services              Mountain View, CA 94043-4033
----------------------------------------------------------------------
----------------------------------------------------------------------
email: jjohnson@synopsys.com                       phone: 415-528-4877
----------------------------------------------------------------------
Check out Synopsys' home page on the Web!      http://www.synopsys.com
----------------------------------------------------------------------