A Comprehensive Guide to Scripting and Automation on Mac OS X

Posted: 15-Jul-2006

Mac Guild Grade

Publisher: Friends of Ed / Apress


Reviewer: Mike Lloyd $59.99

A Comprehensive Guide to Scripting and Automation on Mac OS X

By Hanaan Rosenthal
ISBN: 1-59059-404-5
850 pages, $59.99

What the Book is About
AppleScript: A Comprehensive Guide to Scripting and Automation on Mac OS X provides a detailed guide to AppleScript suitable for the beginner to the experienced scripter. This book is suitable for use as both a tutorial and a reference guide.

Target Audience
This book works at many levels. It is a useful introduction to the novice scripter as well as an outstanding reference for the expert.

What to Expect
In general, the book is divided into four basic sections (the introduction and three major parts). These sections are the "front matter", "Read Me First", "How to AppleScript", and "The Wild World of AppleScript".

The front matter contains a "Contents at a Glance" followed by the "Table of Contents". The "Contents at a Glance" consists of the chapter headings contained in each part while the "Table of Contents" drills down to the section headings, which provides additional insight into the contents of each chapter. These sections are followed by information on the author and the technical reviewer, which are followed by a promotion of AppleScript and the book. The final section of the front matter gives the reader additional AppleScript resources that are available, such as web sites, user groups and companies that provide training.

Part One, or "Read Me First", discusses the rationale for using AppleScript, which could be applied to any scripting language. It also gives an overview of AppleScript and how it fits into the fabric of Mac OS X and the applications that run in this environment. The author also provides advice on how to structure scripts using AppleScript's object oriented architecture to maximize reuse and simplify their development.

Part Two, or "How to AppleScript", builds up from the basics of how to use the Script Editor to the creation of Script Objects. There are over 500 pages of material in this section. The author covers standard material needed to understand the structure of this language, such as variable types, operators, data structures, conditional and loop statements, dialog boxes, error handling and subroutines. The final chapter of this section, Script Objects, establishes a foundation that enables the reader to build a library of AppleScript objects that can be referenced in multiple scripts and leverages the developer's effort by allowing reuse of script functions previously written.

Part Three, or "The Wild World of AppleScript", moves the discussion to how AppleScript can be used to manipulate applications and Mac OS X through their AppleScript application programming interfaces (API). It also deals with scripting applications that do not have an extensive API using the GUI programming interface. The author also discusses scripting databases, automating workflows and running Unix applications. This part also discusses scheduling scripts and controlling remote programs, and provides excellent discussions on debugging scripts, practices to use while developing scripts, and advice on moving into the business of automation.

The book provides a great deal of information concerning AppleScript that is useful for the beginning AppleScripter. The book starts with basic elements such as the organization of the Script Editor interface, which is then followed by a tutorial of Script Editor's capabilities by guiding the reader to enter specific script commands and view their result. This chapter also covers fundamental concepts of object oriented programming, such as classes, inheritance, and properties. Throughout this section and the rest of the book, the author provides a number of examples that culminate fully functional scripts that illustrate the concept just presented. By providing this contextual information, the concept and its usage is much easier to use and is firmly cemented in the reader's mind. The expert scripter can use this information to gain a solid understanding of key AppleScript concepts if they are just beginning to use AppleScript.

The book's breadth of coverage is certainly worth the price of admission. The book covers the basics such as Script Editor usage, variable naming, and AppleScript syntax. The book builds the reader's knowledge by providing sections on building user interfaces, interacting with files, and using subroutines and script objects. This is followed by coverage of the fundamentals of interacting with other applications and database systems. The book culminates with a discussion of the use of an integrated development environment, Smile, to support the development of script for use in a production environment leading to a discussion of the business of the script development.

The book can be used both as a tutorial and reference guide. The numerous examples with functional scripts plus the specific tutorial sections established the tutorial view of the book. By providing a detailed Table of Contents and a comprehensive index, the book can also be used as a reference guide.

The author also sets a tone for the use of a disciplined development strategy, that when followed will pay benefits to the readers in their future development. This viewpoint is established in the introductory chapter, with commentary sprinkled throughout the book. This viewpoint is amplified in the chapter dedicated to "healthy script writing". This chapter covers variable naming conventions, performance optimization, and the use of subroutines and libraries. By using this discipline, the script developer will minimize the errors introduced into the script currently under development, simplifying its debugging, and improving the developer's efficiency in the future.

Mac Guild Grade
A (Outstanding)

Final Words
The "Comprehensive Guide" subtitle for this is an accurate description of the contents of this book. If you are interested in gaining a solid understanding of AppleScript and its use in the Mac OS X, buy this book. It jump starts your development activities and lays the foundation for a disciplined development style. Since the book was published in 2004, prior to the release of Automator, there is no treatment of it in this book. I hope the author is planning on publishing a new edition of this book that includes a chapter on Automator. For a book on Applescript, this book provides in-depth insight into AppleScript and its use, making it an outstanding part of a Mac user's library.