Returning an NSDictionary/record to AppleScript command
Returning an NSDictionary/record to AppleScript command
- Subject: Returning an NSDictionary/record to AppleScript command
- From: Jerry Krinock <email@hidden>
- Date: Sun, 10 Dec 2006 09:58:02 -0800
- Thread-topic: Returning an NSDictionary/record to AppleScript command
I have been able to return an NSString to an AppleScript command. In the
sdef, I give the command 'result' tag an attribute type="text" and it "just
works".
Now, I want to get fancy and return a dictionary of three numbers instead of
a string. In the Cocoa Scripting Guide, I read that NSDictionary is
equivalent to an AppleScript record, so, being simple-minded, in the app I
return an NSDictionary to the command, and in the sdef for the command I
change result's type= to "record".
No good. I get this:
Error while returning the result of a script command: the result object...
{nCopied = 0; nDeleted = 0; nIgnored = 1098; }
...could not be converted to an Apple event descriptor of type 'record'.
This instance of the class 'NSCFDictionary' doesn't respond to
-scriptingRecordDescriptor messages.
Is there some secret sauce I need to return an NSDictionary to AppleScript?
Thanks,
Jerry Krinock
STUFF I'VE ALREADY TRIED...
Cannot find any documentation on -scriptingRecordDescriptor, except the fact
that it is probably a NSAppleEventDescriptor*.
In the sdef, Types, I've also defined a record-type with three properties
corresponding to the three numbers. But if I change the command's result to
type="migration result", AppleScript seems to not even get the result, not
even an error message.
Adding "as migration result" to the script, like this:
migrate
set migrationResult to result as migration result
won't even compile.
_______________________________________________
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