Re: Scripting support problems
Re: Scripting support problems
- Subject: Re: Scripting support problems
- From: Dustin Voss <email@hidden>
- Date: Tue, 21 Sep 2004 21:07:07 -0700
It's probably your implementation of objectSpecifier, or else an incomplete dictionary or sdef file. Have you followed the good advice on <http://cocoadev.com/?HowToSupportAppleScript>?
On 21 Sep, 2004, at 6:15 PM, Doug Knowles wrote:
I'm trying to get scripting support working in an application I'm starting, and I'm part way there (after following advice found on this list), but I'm stumped by the partial results I'm seeing. Briefly, my application will enumerate a property I've defined, but not accept a scripted reference to the property.
My subclass of NSDocument exposes a to-one reference to an object of class "Category" via a method named "rootOrganizer"; the terminology defines the property as "root organizer". I have implemented objectSpecifier: on the referenced object per advice I found on this list.
As things stand now, if I write a script to enumerate the properties on my document, my new property does appear in the event log:
set props to properties of document 1
{false, name:"Untitled", missing value, document, root organizer:root organizer of document "Untitled"}
However, if I try to reference the new property, I get errors:
- if I use the method name directly, the script compiles but reports an error:
get rootOrganizer of document 1
"Prospector got an error: NSCannotCreateScriptCommandError"
- if I try to use the defined terminology (which gets reported out as shown above, I get a compilation error
set org to organizer of document 1
...I get a compilation error "Unexpected end of line, etc. but found identifier."
I feel like I'm close to getting this right, but I can't figure out what I'm missing. I considered the possibility that there's a nuance between an attribute and a to-one object reference, but I can't figure out another way to implement it...
Any help appreciated.
TIA,
Doug K;
---------------------------------------
My objectSpecifier method:
- (NSScriptObjectSpecifier *)objectSpecifier
{
NSScriptObjectSpecifier *containerRef = [[self repository] objectSpecifier];
NSPropertySpecifier *spec = [[NSPropertySpecifier allocWithZone:[self zone]] initWithContainerSpecifier:containerRef key:@"rootOrganizer"];
return spec;
}
---------------------------------------
Script and terminology files available on my iDisk public folder to keep this message at an acceptable length:
http://homepage.mac.com/dougknowles/ScriptProblem/ _______________________________________________
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
_______________________________________________
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