Review: AppleScript in a Nutshell: A Desktop Quick Reference (book)
Developer: Bruce W. Perry, O’Reilly and Associates, Inc. (product page)
Price: $29.95 (direct from publisher); $20.96 (Amazon.com)
Trial: sample chapter
This is the only book in print that covers the recent AppleScript 1.4 changes for Mac OS 9.1 and Mac OS X. This AppleScript reference book is geared towards network support personnel, power users, and graphics professionals. The press notice also claims it is aimed at “script novices,” but this book is not for people who have never programmed in AppleScript or HyperTalk.
Layout and Organization of the Book
The soft cover book measures 6" by 9" and has 499 pages. The book has six parts, including the appendices. You can view the table of contents. The book’s organization works well and is better than other programming guides I have used. The 23-page index is comprehensive and helpfully identifies OS X-specific page references when appropriate.
Observations and Opinions
The introductory chapter focuses on Apple events. This unusual introduction exemplifies why this book is inappropriate for novice scripters. However, non-beginners can appreciate the good overview of Apple events and how AppleScript works with them. The second chapter describes Script Editor, Apple’s application for composing and running scripts. It does not discuss alternative environments such as Smile, Facespan, or Scripter.
Part II, “AppleScript Language Reference,” contains seven chapters. The “Data Types” chapter contains great information on the numerous AppleScript data types and about “coercion” of data into a different type. Chapter 5, “Reference Forms,” has a nice overview of how AppleScript references work. Chapter 6, “Variables and Constants,” covers variable creation and the use of predefined constants. It also taught me the difference between the set and copy commands in AppleScript. You can look at Chapter 7, “Flow Control Statements,” online. Chapter 8, “Subroutines,” suffers from a dearth of examples. I wished for examples of calling subroutines and passing labeled parameters. Chapter 9, “Script Objects and Libraries,” also suffers from inadequate explanations and examples. I did not get a good feel for the utility of creating objects or libraries.
Part III, “Scripting Mac OS 9 Applications,” contains nine chapters about scripting Apple’s OS 9 applications. There is no information on scripting third-party applications such as BBEdit, Photoshop, or Microsoft Office. Instead, the author devotes space to describing how to script Apple System Profiler and the Desktop Printer Manager. These chapters mostly summarize and reorganize the information found within the scripting dictionaries of Apple’s applications. However, the two chapters related to the Finder contain good scripting examples and excellent discussions of the Finder’s object model and the inheritance structure for Finder elements. The Finder classes chapter can be difficult to follow because the only visual difference between a description of a class versus its elements is the degree of indentation (the font sizes and styles are the same).
Part IV, “Scripting Mac OS 9 Control Panels and Extensions,” contains 13 short chapters. I felt much of this was a waste. Why describe such trivial tasks as scripting the Appearance Manager or the Location Manager? Experienced scripters can just examine the AppleScript dictionaries to learn how to script these items.
Part V, “Scripting the Mac OS X System,” includes three chapters on scripting the Desktop, Mail, and Text Edit applications. A fourth chapter describes how to run scripts with the Terminal application. This will be useful for people who long for command-line interfaces.
Strengths of This Book
- Up-to-date AppleScript reference book.
- Well organized.
- Covers the common applications, control panels, and extensions included with Mac OS 9 and OS X.
- Not enough scripting examples.
- No coverage of scripting third-party applications.
Peachpit Press plans to publish Applescript for Applications: Visual QuickStart Guide by Ethan Wilde (Editor) in late October. However, its predecessor, “Applescript for the Internet Visual QuickStart Guide,” received mixed reviews. I hope this new book will be better. Danny Goodman wrote a second edition of his AppleScript Handbook in 1998, which was republished last year by toExcel via iUniverse. It doesn’t include the latest scripting information for OS 9.1 and OS X, but it is an excellent guide for the intermediate to advanced scripter. This is a handbook, not a reference book, and includes more explanations and examples.
AppleScript is wonderful technology, but it gets used by a very small proportion of Macintosh users. I hope that the increased use of OS X triggers more interest in AppleScript. An increase in AppleScript users will inspire authors to write more AppleScript books.
AppleScript in a Nutshell is a good reference for programming Mac OS software for intermediate to advanced scripters. However, it contains no information on scripting common business or graphics applications.