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: Steve Evangelou <email@hidden>
- Date: Fri, 18 May 2007 10:04:06 -0700
Some more information would help:
What does your sdef look like? Does it establish a container
relationship, such that Cocoa scripting can resolve down to your
singleton object? Typically, scripts work from the application down
through documents and other contained objects.
And the recommended starting sdef for Cocoa apps is Skeleton.sdef,
not Image Events.sdef.
<http://developer.apple.com/samplecode/ScriptingDefinitions/index.html>
What script are you using to test?
Have you turned on debugging output and examined the generated Apple
events?
<http://developer.apple.com/documentation/Cocoa/Conceptual/
ScriptableCocoaApplications/SApps_debugging/
chapter_9_section_4.html#//apple_ref/doc/uid/TP40001981-CJBHFBJJ>
Thanks.
Steve
On May 17, 2007, at 12:02 PM, email@hidden wrote:
Message: 12
Date: Thu, 17 May 2007 10:51:30 -0700
From: Dave Camp <email@hidden>
Subject: How do I make a singleton object AppleScriptable?
To: Cocoa-Dev List <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
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
_______________________________________________
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