Apples Tiger Targets Easy Programming with Automator
Tigers Automator still carries its code name of Pipeline in the version released to developers at Apples recent Worldwide Developers Conference in San Francisco. The tool is an attempt by Apple to make automating repetitive tasks on the Mac easier than has been the case previously.
As demonstrated at the conferences keynote address, the software is aimed at ordinary users and no coding will be required. Instead, Automator relies on a simple scripting model that involves dragging and dropping "Actions," which are then linked automatically together to form a pipeline, though which files or objects flow.
Automator will leverage AppleScript, the longstanding native scripting language of the Macintosh, which was integrated and then extended in Mac OS X. The technology lets users control applications as well as the Mac OS directly with natural-language instructions.
Apples object-oriented Cocoa framework supports AppleScript as well as the companys current AppleScript Studio environment and the Interface Builder component of Xcode. Apple also uses the technology within OS X to tie various applications together, according to an Apple engineer.
But Automator is not simply a new front end to AppleScript. Although its capable of running AppleScripts as well as Unix shell scripts, Automator Actions are compiled C++ code. Third-party developers wanting to let customers use their applications in the Automator environment will need to write their own set of Actions, in addition to opening them up to AppleScript.
The prerelease version of Automator currently comes with 123 Actions that are grouped into categories according to function. The categories include Mail, Find, Alert, People and iPod, and users can search for Actions using Tigers standard Mac OS X search field.
The alternate view command groups the Actions by keyword, which can be a quick way to narrow down the choice when searching for a particular Action. The set of Actions offered to developers is not restricted to Apples own applications: Currently, it includes Actions included for Microsoft Corp.s PowerPoint presentation software.
Putting together Actions in Automator is simple: Users drag an Action from the well on the left-hand side of the screen to a list on the right, and then another. If the pair has matching inputs and outputs, the two items will be joined.
But users wont be able to link together two items that dont match, so that if an Action expects to receive an image, for example, it wont work on a text file. When an output and input dont match, Automator highlights the offending link in red. This may cause some confusion for inexperienced users at its release onset, especially with images stored in PDF, the native file format of Mac OS Xthe beta version of Automator currently considers PDF a nonimage format.
How powerful this graphical approach to scripting is will depend on the breadth of the Actions available. Certainly, the preliminary set supplied with the developer release offers a reasonable sample, more than enough for customers to put together a range of effective scripts.
In addition, Automator users will be able to save completed scripts as sharable, standalone applications, supporting the common Mac interface of drag-and-drop processing of files. A script to batch-convert images to JPEG format, and save the resulting files with amended names, could take as few as three steps with the environment.
The Actions in the prerelease set include the ability to mount specified servers, create slideshows in QuickTime and Apples iDVD authoring tool, and create events in the iCal calendaring software bundled with the OS. The environment supports alerts and lets the script wait for user input. Scripts also can send and receive messages via iChat or SMS (short message service).
A number of developers said Automators inclusion of support for shell scripts is a powerful feature, opening the environment up to the resources of the Unix command line. Both AppleScripts and shell scripts are treated by Automator as simply another step in the script. In a script, the results of an Action can be passed to a shell script and its results, then retrieved and passed on for further processing with other Actions.
Those familiar with the prerelease software said there are gaps in the current set of Actions. Developers looking for a more complex environment for scripting the Mac platform will likely continue with AppleScript Studio, insiders said.
For example, the current lack of conditionals gives scripts no way of handling error conditions other than to simply abort the script. Developers creating custom workflows for customers in the Macs professional content creation or scientific and technical markets will need the more complex scripting capabilities offered in the current tools, they suggested.