Adding script capabilities to keynote
Adding script capabilities to keynote
- Subject: Adding script capabilities to keynote
- From: Olivier Destrebecq <email@hidden>
- Date: Wed, 7 Dec 2005 12:21:07 -0500
I'm trying to add script capabilities to keynote 2. I know this is
possible since someone has already done it.
My approach is to create a plugin that will be loaded by keynote at
start up (it loads a few bundle contained in resource/animation, so i
just add mine there).
The plugin seem to load fine, my categories seem to be added, my
initialize method on my principal class i called and i can break in
there.
In this initialize method i do:
[[NSScriptSuiteRegistry sharedScriptSuiteRegistry]
loadSuitesFromBundle: [NSBundle bundleForClass: [self class]]];
to load my script suite.
now the problem:
I run keynote and script editor and the suite is loaded.
But when i run a script sometimes it works (in which case everything
works until the next keynote reboot) or it does not (in which case it
does not work until I restart keynote.
I get an NSReceiverEvaluationScriptError (3) when it fails. Which
pretty much means it does not manage to find the object the script
talks about.
Any idea of what might be causing this intermittent working?
I include the script suite just in case it comes from there:
script terminology:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://
www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Classes</key>
<dict>
<key>BGDocument</key>
<dict>
<key>Description</key>
<string>A Keynote document</string>
<key>Name</key>
<string>slideshow</string>
<key>PluralName</key>
<string>slideshows</string>
<key>ToOneRelationships</key>
<dict>
<key>pcCurrentSlide</key>
<dict>
<key>Description</key>
<string>Current slide in the slideshow</string>
<key>Name</key>
<string>pc current slide</string>
</dict>
</dict>
</dict>
<key>BGSlide</key>
<dict>
<key>Attributes</key>
<dict>
<key>pcCurrentBuildIndex</key>
<dict>
<key>Description</key>
<string>The build index of the slide during the slide show</string>
<key>Name</key>
<string>pc current build index</string>
</dict>
<key>titleText</key>
<dict>
<key>Description</key>
<string>The title of the slide.</string>
<key>Name</key>
<string>title text</string>
</dict>
</dict>
<key>Description</key>
<string>A Keynote slide</string>
<key>Name</key>
<string>slide</string>
<key>PluralName</key>
<string>slides</string>
</dict>
</dict>
<key>Commands</key>
<dict>
<key>PCExport</key>
<dict>
<key>Arguments</key>
<dict>
<key>File</key>
<dict>
<key>Description</key>
<string>The file in which to save the object.</string>
<key>Name</key>
<string>in</string>
</dict>
</dict>
<key>Description</key>
<string>Export command by the profcast addition</string>
<key>Name</key>
<string>pc export</string>
</dict>
</dict>
<key>Description</key>
<string>Addition required for ProfCast</string>
<key>Name</key>
<string>ProfCast additions</string>
</dict>
</plist>
scriptsuite:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://
www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppleEventCode</key>
<string>PrCa</string>
<key>Classes</key>
<dict>
<key>BGDocument</key>
<dict>
<key>AppleEventCode</key>
<string>docu</string>
<key>Superclass</key>
<string>Keynote.BGDocument</string>
<key>SupportedCommands</key>
<dict>
<key>PCExport</key>
<string>handlePCExportScriptCommand:</string>
</dict>
<key>ToOneRelationships</key>
<dict>
<key>pcCurrentSlide</key>
<dict>
<key>AppleEventCode</key>
<string>PCcs</string>
<key>ReadOnly</key>
<string>YES</string>
<key>Type</key>
<string>Keynote.BGSlide</string>
</dict>
</dict>
</dict>
<key>BGSlide</key>
<dict>
<key>AppleEventCode</key>
<string>KnSd</string>
<key>Attributes</key>
<dict>
<key>pcCurrentBuildIndex</key>
<dict>
<key>AppleEventCode</key>
<string>PCbn</string>
<key>ReadOnly</key>
<string>YES</string>
<key>Type</key>
<string>NSNumber</string>
</dict>
<key>titleText</key>
<dict>
<key>AppleEventCode</key>
<string>PCti</string>
<key>ReadOnly</key>
<string>YES</string>
<key>Type</key>
<string>NSString</string>
</dict>
</dict>
<key>Superclass</key>
<string>Keynote.BGSlide</string>
</dict>
</dict>
<key>Commands</key>
<dict>
<key>PCExport</key>
<dict>
<key>AppleEventClassCode</key>
<string>PrCa</string>
<key>AppleEventCode</key>
<string>PCex</string>
<key>Arguments</key>
<dict>
<key>File</key>
<dict>
<key>AppleEventCode</key>
<string>kfil</string>
<key>Type</key>
<string>NSString<FilePath></string>
</dict>
</dict>
<key>CommandClass</key>
<string>NSScriptCommand</string>
<key>ResultAppleEventCode</key>
<string>bool</string>
<key>Type</key>
<string>NSNumber<Bool></string>
</dict>
</dict>
<key>Name</key>
<string>ProfCastAdditions</string>
</dict>
</plist>
Olivier Destrebecq
http://otusweb.spymac.com/portfolio/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden