Automating


Most of the real bang for the buck with OS X Tiger is under the hood, but as cool as things like Core Image are, Apple found it easier to focus their marketing on three key features: Dashboard, Spotlight, and Automator. The only problem with this is that they’re not done yet.

Spotlight should have been released as an open beta for users to play with and developers to write plug-ins for. Instead, Apple made it pretty much the only way to search in Tiger, and hijacked a very useful keyboard shortcut to activate it. Worse, the indexing process is a major pig, and the default behavior is to index the entire contents of any disk you attach to your computer, as soon as you connect it.

Dashboard is a cool prototype of a number of ideas. If they ever finish the APIs necessary to write full-featured programs in DHTML, a thousand useful special-purpose tools will appear. As it is, all we’ve got are a thousand web-scrapers, search buttons, and picture viewers, and many of them are CPU hogs. To be honest, I’m more excited by the tantalizing glimpse it gives of a future desktop-layering API; the way that the Dock, Exposé, and Dashboard exist outside the desktop while interacting with it has real potential. I think we’re going to see more such layers in future releases; the most obvious candidates are screen savers and the grab-bag of tools with “float above over windows” options, but there are certainly others I haven’t considered. My other hunch is that a mature version of Dashboard would be a perfect match for an Apple PDA; the SDK’s emphasis on small size and distinctive front graphics fits almost too well.

Which brings me to Automator. It’s actually good enough to call a released application; the problem is that it isn’t what Steve told us it would be. In another year, perhaps, third-party developers will have fleshed it out with a wealth of plug-ins that make it possible to really tie your applications together in useful ways without programming, but it’s not there yet.

So. Today’s problem: my manager’s SO has 3,680 audio files that she wants to put on her iPod. Unfortunately, they’re in a format iTunes doesn’t understand. Google turned up a few Windows utilities that claim to grok this format, but the only Mac tool likely to work was a Mac OS 9 app, and I really didn’t want to reinstall Classic just to find out.

To my surprise and delight, however, QuickTime Player reads them just fine, and it has an Export function that will let me write them out in AIFF or WAV format. In theory, this is a perfect task for Automator: “for each file in these directories, open it up and write it back out in WAV format, then send the whole lot to iTunes and have it convert them to MP3/AAC”. In practice, however, the only thing that Automator can do is allow you to select the files and send them to QuickTime Player; converting them requires a bit of AppleScript programming. Automator will run that script once you’ve written it, but unless you get lucky and find something on the web that’s pretty close, it may take longer to automate the solution than to do it by hand.

I got lucky. Even better, I happen to have another 8,400 of these files that I wouldn’t mind having on my iPod…

[update: it turned out to be easier to hack the script to walk the directory tree directly, so I don’t need Automator at all, just AppleScript. The only way to improve the script further would be to write it in Perl and generate the necessary AppleScript; that way I could have a decent string-handling library.]