Mac OS X 10.4 'Tiger in depth
Part two: Automator, AppleScript, iSync, iCal and Address Book
Review The Register's in-depth look at Apple's Mac OS X 10.4 Tiger continues. Last time , we looked at 10.4's headline features - Spotlight and Dashboard - and here we'll explore Automator, the latest attempt of the OS at system scripting.
Automator and AppleScript
In the early 1980s, computers were largely sold on the basis that they would be programmed by their owners. The rise of packaged software and growing numbers of purchases made by non-techies eventually killed that idea, but Apple has been one of the few companies to continue to bundle user-oriented programming tools long after users stopped communicating with their systems using BASIC commands.
HyperCard continued to be bundled on Macs through to the mid-1990s, but by then Apple had begun including AppleScript too, tapping into the Mac OS then new inter-application communications system and its existing system-wide macro facility. AppleScript was designed to make programming simple tasks easy by ditching abstruse programming languages in favour of plain English. AppleScript never became the BASIC of the 1990s, but it found a niche among people looking to automate content-creation workflows.
AppleScript has evolved ever since, taking on more features and morphing over time into something more like a 'true' programming language that the simple scripting language it started out as. This was cemented a few years ago when it became an official Mac OS X language for program development, courtesy of Xcode's AppleScript Studio.
The downside is that it has become progressively harder to use AppleScript if you're not a programmer. Mac OS X 10.4's Automator utility is about making it relevant to non-programmers again.
Automator is certainly impressive at first glance. You create Workflows - what might once have been called Scripts or macros - simply by dragging separate Actions onto flowchart. Actions are basic tasks, such as 'choose some files' and 'resize a picture', and derive from a range of Mac OS X's bundled apps, including Automator itself and Finder.
In essence, Actions are encapsulated chunks of AppleScript code that tie into the applications' existing scriptable features, along with the UI elements that Automator displays. But while you can save Workflows either as Automator documents or standalone apps, you can't edit them in Script Editor, Mac OS' bundled AppleScript writing tool. You can, however, embed AppleScript code into Workflows, along with Unix shell scripts.
The 'visual' programming metaphor is nothing new, of course, but it's no less welcome for that, and it once again opens Mac OS X, or elements of it, to non-programmers.
And to Apple's programmers, too. Tiger's PDF output options, accessed through the Print dialog are all implemented as a series of Workflows. If 10.4's printing system can tap into the Workflow engine, so can other apps, allowing Automator-created applets to form the basis for application plug-ins too.
Automator's flaw is that it's not extensive enough. Almost all of the applications supported by Automator have scope to do much, much more than the suggestedf by the sample Actions included with 10.4. Ditto non-supported but equally Scriptable apps. Third-parties will come to fill the gaps - but that's going to be of more use to professionals who were already using AppleScript to automate document workflows, than to novices.
Pros are likely to stick to AppleScript in any case, because Automator provides no control logic. It can't pass custom data between Actions, and there's no way of moving on to one Action rather than another on the basis of a user selection or the value of a variable. You can do this in AppleScript, of course, but you've got to learn the syntax first.
Hopefully, Automator will evolve quickly into a visual AppleScript generator, allowing savvy users to create branched, more interactive workflows without sacrificing the simple 'one step after the other' flow Automator imposes today. Until then, it's usage will be limited to the kind of tasks Apple already bundles pre-written AppleScripts - batch utilities for renaming files and folders, resizing pictures, that kind of thing.
What Automator can do, that AppleScript alone could not, is take those basic Workflows and apply them as plug-ins to other applications. I set up a simple Workflow to ask me if I want to do a back-up. If I say yes, it closes down all my Finder windows and opens a pair of Smart Folders that list the folders I want to make sure I have back-up copies of. I saved this Workflow as an iCal plug-in, and Automator creates a calendar entry with the Workflow set to trigger as the alarm. Now, every Friday at 11am, up pops a message asking me if I'd like to do back-up my data.
Well, that's how it should have worked. Most of this was actually achieved with an AppleScript embedded in the Workflow. Why? Because the Finder Actions bundled with Automator don't include basic tasks like closing windows. As I say, a huge range of basic functions accessible through AppleScript are not accessible through Automator. Apple has to expose all these features if Automator is to become more than a toy.
Apple has updated Script Editor too, but the results are largely cosmetic: in the main a nice new browser-style readout for applications' AppleScript dictionaries. AppleScript now has its own preference-setting utility, AppleScript Utility, which operate beyond Script Editor's domain, which is why they're implemented separately. Surely a System Preferences pane would be more useful - and more in keeping with Apple's own UI guidelines. But as we saw with the metal-skinned Finder, it's happy to ignore its own rules. Whatever, AppleScript Utility replaces all the little Folder Action set-up and Script Menu control scripts of old, even though they're still included...
Other tweaks to AppleScript include extensions to allow coders to work with XML, Apple's own .plist files and SQLite databases. User interactivity has been enhanced with new dialog options allowing sensitive data to be masked as it's typed, while ensuring AppleScript-generated dialog boxes are more in keeping with 10.4's overall look and feel. Tiger's Font Book font manager app is now scriptable.
Automator and Script Editor will happily exist in Applications folder sub-folders. Before 10.4, System Preferences had to sit in the main folder, to the annoyance of folk like me who prefer to organise their applications in separate sub-folders by type. In the new Finder-free world of Spotlight, such organisation is unnecessary - seek and ye shall find, no matter how cluttered your Applications folder. Apple has fixed System Preferences, but broken iSync and the various Bluetooth utilities. iSync now has to go at the top level of the Applications folder or syncing breaks, even when you double-click on it. Move Bluetooth Serial Utility, Bluetooth File Exchange or Bluetooth Setup Assistant from the Utilities folder and you won't be able to run then from the Bluetooth menu icon, if you've chosen to make it appear. They do work if you double-click on them, however.
For me, iSync and Bluetooth are integral - I use both to synchronise my Nokia 6600 with both iCal and Address Book. It works now, but it took some fiddling to get it right. I'd advise breaking previously set up pairings and starting from scratch, though my set-up was confused slightly by the use of two separate handsets. Bluetooth seems less able to cope with different devices doing the same thing (not simultaneously, I hasten to add), so if you access phone A from Address Book to dial a number, it's not easy to get Address Book to subsequently dial a number through phone B.
iSync now installs a controller app on the device - at least on Symbian handsets - and the code itself is more tightly integrated into Mac OS X. Apple claims synchronisation is faster as a result, and it certainly felt a little quicker, though without exact before and after timings it's difficult to be certain. Palm synchronisation was slower, however, because iSync defaults to its Force Slow Synchronisation for some reason.
Personal Information Management
iSync remains primarily a PIM tool, tying devices into the data maintained by Mac OS X's Address Book and iCal apps. Apple clearly wants to protect iPod, so you can see why there's no iTunes playlist synchronisation, but it's about time that photos and documents were supported. DataViz will no doubt sort out the latter when it ships a version of DocumentsToGo for Series 60 - there's already a version for UIQ handsets like the Sony Ericsson P910i, and Palm OS machines are well supported.
iCal and Address Book are among the apps best supported by Automator. It was a doddle to create a Workflow that summarises the coming week's diary entries and speaks them out loud. It's this ability to string together tasks that makes Automator interesting, rather than its ability to automate repetitive processes. As I say, it really needs more building blocks, though. iSync is scriptable, but where's the Automator action to trigger it?
Address Book gets the Smart Folder treatment in 10.4, though here they're called Smart Groups, matching all your contact entries against a set of criteria. The app's printing options have been enhanced with a rather neat envelope printing option, and what Apple calls a Pocket Address Book, though if you've any more contacts than a dozen or so, you'll end up folding a lot of pages to make it pocket size.
iCal lacks Smart Calendars, which would have been a handy way of, say, listing all the upcoming meetings you have with a specific company or contact. But Calendars can now be grouped to keep related diaries together. You've been able to back-up your Address Book database for some time, and you can now do the same thing with iCal. ®
To be continued...