|
I am a big fan of AppleScript. I use it infrequently, but the time I have saved myself over
the years is substantial. AppleScript is the Mac OS’s built-in control language; a tool to
drive the Mac on autopilot while the user sits back and enjoys the increased productivity.
AppleScript can be devilishly confusing to learn, but do not let that intimidate you. I
still find writing AppleScripts a challenge, but once I get a script working the way it
should, I make my Mac work a little harder, so I don’t have to.
The original idea behind AppleScript was a terrific Mac-like concept: Create a standard
method for users to control the Mac and automate repetitive tasks. What happened along the
way was a classic paradox that occurs too frequently in the computer industry. Enough
users did not demand scripting support, so developers concluded that it would not enhance
their product in the marketplace. And since most applications did not support
AppleScript,
new users did not know what they were missing and as a result never demanded it. The good
news is that the some commercial developers, a raft of shareware developers, and dedicated
advocates have created an excellent collection of scriptable applications.
I’ve been playing with AppleScript for about ten years. Those years might imply I’m an
expert, but I am just the opposite. A perennial duffer, I usually learn just enough to
build a script that makes a particular task easier, then forget about it. Software changes
quite a bit over time, and rarely do I need to set up the same activity twice. Five years
ago I needed a script to control my PPP dialup connection; last week I needed to automate
some special FTP file transfers. But even if a script saves only a few seconds each time
it is run, those seconds add up quickly if the script is used hundreds or thousands of
times. The other key benefit is that once the script works, the set of repetitive tasks it
is set up to do will be done correctly every time.
The first step in creating a good script is to choose a task that does something you need.
Writing scripts that do this trick or that trick may be interesting, but it’s unlikely
they will be useful in your everyday work. I approach script development as combining two
basic ingredients, which I call techniques and application-specific abilities. I consider
techniques a tool kit of reusable methods for getting things done. Once learned, they are
used in every script you will ever write. Examples of a technique include a repeat loop or
an if-then test. Application-specific abilities do just what the name implies. For
example, having the Finder create a new folder, or asking Outlook Express to send an email
message. Unfortunately, teaching how to write an AppleScript is beyond the scope of this
article. However, there is plenty of information to help make you a scripter in no time on
your Mac (check out the Help Center), and on the Web.
If AppleScript is so great, then why haven’t I heard about it? Good question. Although
AppleScript is installed on every Mac, it has only become popular in a limited number of
ways. However, if you look in the right place, you will find an active online community
and extensive information on how to learn and use AppleScript. The best place to start is
Apple’s Web site at www.apple.com/applescript. It has a list of available scriptable
applications and links to the essential AppleScript resources on the Web. There are two
noteworthy links that deserve extra-special attention for newbies. The first is Bill
Brigg’s AppleScript Primers. The second is the MACSCRPT email discussion list.
This article does not begin to cover the benefits of AppleScript, or the myriad tasks you
can automate. But I do have one more bit of advice: If you try a little AppleScript and
hunger for more, one of the first things you should do is get a good third-party script
editor. The best place to start is the freeware Smile editor. I like Script Debugger (in
part because there is a version under development for Mac OS X). The other commercial
editor, Scripter, is also quite good and there is a personal edition available for a
reasonable cost. Any of the three is a good window into the productivity-enhancing world
of AppleScript.
|