Dyce & Sons Ltd.

Helping IT since 1993

AppleScript in a Nutshell

Friday 14th September, 2001

Bruce Perry has produced a solid, fairly well-written reference to AppleScript version 1.4 onwards with AppleScript in a Nutshell. This differs from other AppleScript books in two ways - it’s up to date and it’s a reference. Be warned, though, this is not a ‘teach yourself programming book’, nor does it feature the word ‘Dummy’ or ‘Idiot’ in the title. It covers the entire AppleScript core language, from the everyday constructs, such as tell statements, to less well-known features, such as the ‘possessive’ construct, and script objects.

The book is divided into five main sections. The introduction - part one - consists of two chapters. The first details how AppleScript, the Open Scripting Architecture and AppleEvents are linked, how they work and how you might use scripting. The second is a rundown of how Script Editor works and how you enter, compile, save and run scripts and applets (in both Mac OS 9 and Mac OS X).

Chapter and verse

Having rolled up his sleeves, Perry then gets down to business. The seven chapters in part two cover the core language - the data types, operators, reference terms, variables, control statements, subroutines, as well as script objects and libraries. Part three is a nine-chapter tour de force of the standard system level Mac applications, including the Finder, Sherlock 2, plus the more esoteric ones such as Apple System Profiler, Keychain, Network Setup and the Help extension. Continuing where part three left off, the 13 chapters of part four provide a run through of the scriptable control panels and extensions in OS 9, including the more powerful extensions such as Apple Data Detectors, Folder Actions and Speech and Speech Recognition.

Part five is devoted to OS X and has plenty of ‘it wasn’t ready in time’ comments. However, it covers the basics of TextEdit (Apple’s Rich Text editor), the Mail application and the Terminal Application. Part six, the two appendices, cover the Standard Scripting Additions and give a list of AppleScript resources. All in all, this makes for a large book with 470-odd pages of mostly useful stuff.

It’s safe to say that the majority of readers will have two problems with this book. First, the target audience seems unclear. Booksellers will be keen to market it as useful to anyone interested in learning AppleScript and, while it does offer extensive examples of well-written scripts, good coding techniques and solutions to standard scripting problems, this is not a tutorial or cookbook. Although it explains the how and what of coding (How is error trapping handled in AppleScript? What do I do to import script command?), it doesn’t explain the when (When should I use error trapping?).

Second, it does exactly what is says on the tin - it’s a reference. So if you want to know the way to get hold of the RAM disk status for your Mac, then the book will tell you exactly which reference form you’ll need to use. Having said that, it’s a reference to those applications and extensions that come as part of a newly installed Mac. However, it’s not a reference to every scriptable application ever written and where it does make references to other scriptable applications, such as small script snippets, the references don’t make it into the index.

Small print

Given what it is, the book has a couple of other small failings. Apart from the index, the use of typefaces makes the scripts themselves harder to read than necessary. While this is in keeping with other books in the series, it ignores AppleScript’s built-in (standard) formatting. It raises a further embarrassing point. Where Perry discusses general points or gives example scripts, he’s very good. However, much of the book is given over to expanded versions of the application dictionaries that you can examine in the Script Editor.

Some of these expansions are good and worthwhile, but the use of the constant width font for command and class definitions means that the online AppleScript dictionary version (with its variety of styling) is easier to read and understand.

Readers familiar with other O’Reilly books may also be a bit disappointed as this is not part of the Definitive Guide series. But if you’re familiar with other scripting or programming languages then this book provides an ideal transition to AppleScript. If you’re new to programming, then this should definitely be the second book you buy.


if you’re familiar with other scripting or programming languages then this book provides an ideal transition to AppleScript

Get Further Info
Rating 3.5
Manufacturer Bruce Perry
Price 19.95
Originally Published MacUser, Volume: 17, Issue: 17, p35