Hardware Reference
In-Depth Information
it appears in, make it bold, copy it, switch to another app, and paste it—or let AppleScript do
all that for you with one click.
It's that last type of activity—combining strings of actions that involve multiple apps—where
AppleScript especially shines. AppleScript is also good at repetitive tasks (say, renaming
dozens of files or fetching a long list of items from one place and copying them to another
place) that would otherwise be tedious. And it gives you access to features on your Mac
that aren't normally exposed. For example, you just wrote a script that plays a beep, and
although that happens when there's an error, there's no button or menu command that
lets you manually trigger a beep. (AppleScript can trigger lots of actions that are far more
interesting and useful than a beep!)
More importantly, an AppleScript can include logic that enables it to make decisions as it
runs—either on its own, or with your input. It can use programming constructs such as
variables, if-then conditions, and loops, and it can also tie into numerous other automation
tools (such as TextExpander, LaunchBar, and Keyboard Maestro, all discussed elsewhere in
this topic).
Fine, you may say, but what exactly can AppleScript do?
Well, if you want to know every built-in command and option, with detailed background
and examples, check out Apple's massive Introduction to AppleScript Language Guide . It's
written mainly for developers, but it's reasonably clear, and well worth consulting.
But that tells you only about AppleScript itself. To find out what you can do with AppleScript
in a particular app, you'll need to look elsewhere.
Every app that supports AppleScript, including the Finder, contains a dictionary of all the
nounsandverbsAppleScriptcanusetocontrolit.Forexample,theCalendarapp'sdictionary
contains verbs like create calendar and switch view ; and nouns like calendar ,
sound alarm , attendee , and event . To see what's in any app's dictionary, drag that app
onto the AppleScript Editor icon. You'll see something like Figure 37 . Look through the
terms and read some of the definitions to see what sorts of things AppleScript can do in that
app.
Search WWH ::




Custom Search