Re: AppleScript: Returning object references in Cocoa
Re: AppleScript: Returning object references in Cocoa
- Subject: Re: AppleScript: Returning object references in Cocoa
- From: Fritz Anderson <email@hidden>
- Date: Tue, 24 May 2005 13:41:24 -0500
Pascal Pochet kindly points out to me that if one wants to return an
object reference in AppleScript from a Cocoa method, one has the
object in question implement objectSpecifier. AppleScripts that
reference the object, and properties of the object, now both behave
as expected. This was easy, thanks to him.
I still have a problem. Here is my objectSpecifier method:
- (NSScriptObjectSpecifier *) objectSpecifier
{
id uuid = [model objectForKey: @"UUID"];
return [[[NSUniqueIDSpecifier alloc]
initWithContainerClassDescription: nil
containerSpecifier: nil
key: @"entries"
uniqueID: uuid]
autorelease];
}
The intention is to specify the member of the element set with the
Cocoa accessor "entries," in the application container, having the
given UUID. Unfortunately, the reference returns to AppleScript like
this:
<<class >> id "49532713-846E-42D5-BB71-12FD22A7E656"
That is, the class information, which would identify which element
set the object came from, seems to be missing. (I substitute double
angle brackets for the guillemets because Mail seems not to like the
close-guillemet.)
Spelling has been triple-checked.
Can anyone nudge me a little farther? I include a representative
chunk of the sdef from my original post.
-- F
On 24 May 2005, at 11:46 AM, Fritz Anderson wrote:
The (abbreviated) sdef looks like this:
<class name="application" code="capp"...>
<cocoa class="NSApplication">
<element type="setting" ...>
<cocoa key="entries"/>
<accessor style="id"/> <accessor style="test"/>
<accessor style="name"/> <accessor style="index"/>
</element>
...
</class>
<class name="setting" code="Setg"...>
<cocoa class="Setting">
<property name="name" code="pnam" type="string" ...>
<cocoa key="name"/>
<property/>
<property name="id" code="ID " type="string" access="r" ...>
<cocoa key="uuid"/>
<property/>
...
</class>
_______________________________________________
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