In between midnight summer nights and dark winter days

Fixing Keynote '08 and '09 to work with the Scripting Bridge Sat, Mar 14 2009 19:20

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'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:

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:




Remember, always make a backup of any files you modify, just in case you ever need to revert your changes. Happy Keynote-controlling!

Previous: A website in an image Next: FolderGlance and Snow Leopard

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.


Contact me

Recent posts

Jul 28: Running iTunes in a debugger (gdb)
Jul 25: The /Volumes/MobileBackups directory
Jul 20: FolderGlance 3.0.1 supports Lion
Mar 03: Quick tip: Speeding up Xcode compilations
Mar 02: FolderGlance 3.0
Jan 07: Making Universal Back Button work on 10.6.5 and later

Sep 03: Creating pthreads in C++ using pointers to member functions
May 31: Quickly open URLs in Terminal
May 31: Snow Leopard and automatically submitted Crash Reports
May 27: Universal Back Button released for Mac OS X
May 22: The 22 Megapixel Laptop
Feb 09: FolderGlance on MacUpdate Promo

Sep 28: FolderGlance 2.5.3 is out
Sep 21: FolderGlance 2.5.1 adds features and fixes bugs
Sep 16: FolderGlance 2.5 released!
Sep 10: Intriguing: Snow Leopard ships with the iPhone's multi-touch API built-in
Sep 03: FolderGlance and Snow Leopard
Mar 15: Fixing Keynote '08 and '09 to work with the Scripting Bridge
Feb 26: A website in an image
Feb 09: Display wall multi-touch

Feb 19: Spaces.. Spaces.. Spaces.. retires
Feb 08: How-to: Reverse engineering the Dock to fix Spaces
Jan 25: Interacting with wall-sized displays

Dec 20: Interesting Finder bug
Dec 06: Developing applications for the iPod touch (and the iPhone)
Nov 15: Spaces.. Spaces.. Spaces.. and 10.5.1
Nov 15: Thread creation using pthread_create() on Leopard
Nov 13: Spaces.. Spaces.. Spaces..
Nov 07: FolderGlance, Leopard and the More... menu
Nov 06: FolderGlance and Screen Sieve now also on Leopard!
Sep 16: Mysterious window server hangs


RSS feed

Blog frontpage