Re: Scripting support problems
Re: Scripting support problems
- Subject: Re: Scripting support problems
- From: Doug Knowles <email@hidden>
- Date: Wed, 29 Sep 2004 19:41:34 -0400
I'm still working on redefining my suite as a .sdef, but I have a few observations and questions:
- After leaving my project alone for a few days while I was on the road, I came back and tried my scripts
without making any changes to the project, and the script line that wouldn't compile before (
set org to root organizer of document 1) now compiles and executes correctly. This leads me to ask whether the script editor's dictionary is failing to be updated when I build my project, or whether the project itself is failing to update when I change the dictionary source? Should I be versioning my files, and if so, how?
- An awful lot of documentation, sample code, and web references I'm finding still talk about creating .scriptSuite and .scriptTerminology files by hand, as opposed to generating them from an .sdef file. I assume the "old" technique works to some degree; can someone describe the difference between the two approaches?
As always, thanks for the help!
Doug K;
On Sep 22, 2004, at 12:07 AM, Dustin Voss wrote:
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."
...
---------------------------------------
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