Convert iWork '09 files to Office or PDF files via droplets

Feb 10, '10 07:30:00AM

Contributed by: ssawyer

Snow Leopard only hintIf you use iWork extensively, you may frequently face the need to convert your iWork files into either Microsoft Office or PDF files to share with colleagues, either via email or by posting to a website. It's tedious to have to convert them one-by-one, so I put together two droplet scripts to automate the process. They will convert Pages to Word, Keynote to PowerPoint, and Numbers to Excel, or any of the iWork types to PDF, and do it for multiple documents (even of different original types).

A couple of notes about the scripts given below:

  1. These are for iWork '09 on OS X 10.6. I doubt they will work properly for anything earlier.
  2. The scripts create the converted files on the Desktop, with the same file names and an extension matching their converted form. They will overwrite identically-named files on the Desktop without asking.
  3. The scripts try to be intelligent about leaving the iWork apps in the same state they started in -- if an app was not running before conversion, the script will quit it after conversion. Likewise, if the document you're asking to convert was open, the script will leave it open, but if the script had to open it, it will close it when finished.
  4. Keynote is a bit brain dead about conversion, thus requiring UI scripting to get it to convert things properly -- you'll need to have 'Enable Access for Assistive Devices' enabled in the Universal Access System Preferences panel. If you're reproducing or editing these scripts, note that the name of the buttons "Export…" and "Next…" contain single ellipsis characters. They can be typed with Option-; (semicolon) on a US keyboard.
Here are the scripts (100KB download). I'm not including the scripts here in the text because they're kind of long, and get a bit repetitive. [macosxhints.com mirror]

Extra geeky note: Keynote can be made slightly less brain dead for the conversion to PowerPoint case. If you edit Keynote's Info.plist file to include Microsoft PowerPoint 97 - 2004 presentation for Exportable as Document Type Names under the relevant document type definition for .key files, the iWork to Office script can eliminate UI scripting and just save files analogously to the way Pages and Numbers do it. That does not, however, work for Keynote to PDF conversions.

Credit: Much of the hard work was done by the folks at the following two pages:
  1. The general pattern of the scripts
  2. The UI scripting for Keynote
[robg adds: I haven't tested this one; I did mirror the scripts here on macosxhints.com, just in case the original ever vanishes.]

Comments (9)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20100206104340866