Perl

Perl has a surprisingly long history on the Macintosh; years before it was present as part of Unix in Mac OS X, it had been ported to the Classic Mac OS by Matthias Neeracher (see http://www.ptf.com/macperl). Modules to form and send Apple events were naturally part of this port (see http://www.ptf.com/macperl/depts/articles/IPCwMP.html). Support for these modules has continued, under the guidance of Chris Nandor, and they are available to Mac OS X users.

Once again, you have a choice: you can form the raw Apple events yourself, using Mac::AppleEvents, or you can use AppleScript terminology through Mac::Glue. The operation of Mac::Glue is similar to Frontier with its glue tables (and is probably deliberately modelled after it); a glue table for a given application must be formed and stored on disk before you can target that application using AppleScript English-like terminology. In order to get started, you will need Mac::Carbon (which includes Mac::AppleEvents) as well as Mac::Glue; on Tiger these are installed by default, but it can't hurt to check for more recent versions.

To make glue, run the gluemac Unix tool. For example:

% sudo /usr/bin/gluemac /Volumes/gromit/Users/matt2/extra/BBEdit\ 8/BBEdit.app
Making glue for '/Volumes/gromit/Users/matt2/extra/BBEdit 8/BBEdit.app'
What is the glue name? [BBEdit]:
Created and installed App glue for 'BBEdit.app, v8.2.3' (BBEdit)

The resulting glue table contains a document in the standard Perl documentation format (POD, for "plain old ...

Get AppleScript: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.