So I recently wanted to control Keynote from some Objective-C code, and decided that the Scripting Bridge introduced in Leopard would be a good (nay, perfect) fit. Unfortunately, Keynote both in iWork '08 and iWork '09 doesn't work with the Scripting Bridge by default, since the header files produced by the sdp utility end up defining the KeynoteSlideshow class as inheriting from the KeynoteSlideshow class. And no, that is not a typo. The end result is a Keynote.h header file that doesn't compile.

My first attempt at fixing this was to just change the inheritance to refer to the KeynoteItem superclass, which made things compile, but of course failed at runtime. Typical. Instead, the problem could be fixed by changing Keynote's scripting terminology file. An invasive change, yes, but not as invasive as one might think.

The change that had to be made was to rename the references to 'slideshow' and 'slideshows' to 'document' and 'documents' in the "Keynote.scriptTerminology" file located inside Keynote.app's bundle. Doing this enables the sdp utility to create a header file that works correctly with the Scripting Bridge, without breaking Keynote in any way as far as I can determine. Existing AppleScripts for Keynote (of which I suspect there are not very many, but I could be wrong), however, will have to be rewritten to refer to documents rather than slideshows.

The file that must be modified is located here:

Keynote.app/Contents/Resources/Keynote.scriptingTerminology

There are exactly two modifications that are necessary, and easily done using a text editor. In the dictionary defining the BGDocument class, change the following four lines from this:

About me
My name is Daniel Stødle. I live in Tromsø, Norway, at 69.66° North. By day, I work as a researcher at the Northern Research Institute in Norway; by night, I run my company SCSC. I do most of my development on and for Mac OS X. My research is geared towards interaction with and visualization of geospatial data. Read more on my personal page.