How do I make a singleton object AppleScriptable?
How do I make a singleton object AppleScriptable?
- Subject: How do I make a singleton object AppleScriptable?
- From: Dave Camp <email@hidden>
- Date: Thu, 17 May 2007 10:51:30 -0700
This seems like it should be easy, but I can't seem to find docs on it.
I've got a single window utility app with a singleton controller
object I'll call the EngineController. I want to provide AppleScript
access to it such that an AppleScript could get or set one of the
member variables.
I've read the docs for adding scripting to a Cocoa app and I've built
a .sdef file (based on /Developer/Examples/Scripting Definitions/
Image Events.sdef) which defines my Engine class and a single read/
write property called Mode. I added the "cocoa" tags so that it can
use KVO to find my member variable. The sdef file seems to display as
expected in Script Editor and I can compile a script for my app. This
much seems okay.
What I cannot figure out is how to tell the Apple Event manager (or
whatever) that the in memory singleton EngineController object should
be the target of events for the Engine class in my sdef file. There
must be some way to associate the two so that the KVO access for my
member variables works. I have so far been unable to determine how to
link the two together.
How do you do this?
Thanks,
Dave
---
It's not denial. I'm just very particular about the reality I choose
to accept. -Calvin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden