Late last year, Apple generated a wave of negative press after releasing slimmed down Mac versions of the iWork apps — Keynote, Numbers, and Pages. Rewritten from the ground up to focus on ease of use, consistency, and iCloud support, the apps lacked lots of the useful productivity features that Mac users had come to use. One major setback was a significant reduction in AppleScript support, a problem for anyone attempting to automate an iWork-based office workflow.
Apple, however, moved quickly to address growing concern, acknowledging the missing features and committing to return many of them in subsequent iWork updates. Some of the promised enhancements included AppleScript improvements in both Keynote and Numbers (curiously, AppleScript improvements in Pages weren't listed).
Some were skeptical whether these enhancements would come to be, but lo and behold, in January, Apple began making good on its promise. A seemingly minor Numbers update reintroduced nearly the entire suite of Numbers '09 AppleScript terminology. This update restored many existing Numbers scripts to working order and reinstated the ability to write new ones. The release was a welcome step in the right direction, but there was more work to be done, especially in Keynote and Pages. I'm pleased to say that this week, Apple has delivered again. This time, the iWork apps have received a notable set of AppleScript improvements across the board.
Like Numbers, Keynote now includes a compatibility suite of scripting terminology, returning much of its previous scripting support. This means that some existing Keynote scripts may begin working again, although it's likely some tweaks will be needed. Keynote also adds a variety of new scripting features, including better export options and access to extensive slide attributes, such as transitions and presenter notes. With this release, you can write scripts that build entire Keynote presentations from scratch, manipulate slides, play and control slideshows automatically, convert presentations to movies, and lots more.
Enhancements in Pages allow you to write scripts that create new documents based on application or user templates, perform find and replace operations on text (think Mail Merge), add and manipulate content, and even export documents as encrypted PDFs. Pages doesn't include a compatibility suite like Keynote and Numbers, possibly because its overall functionality has changed so much that one isn't applicable. So, if you have existing Pages scripts, the odds are good you'll need to rework them a bit to get them up and running again.
Even Numbers includes some scripting changes above and beyond what was added in the last update. You can now create template-based documents, export in different file formats, and interact more extensively with tables, charts, and other elements.
Sign up for CIO Asia eNewsletters.