Reputation: 12095
In my sdef, I have a command that accepts a parameter of type "Any".
In the script, I pass the reference to a scriptable object:
tell application "myApp"
set theArg to first subItem of appElement -- appElement is an element of the app object
myCommand theArg
end
In my command handler code, when fetching the parameter, I get back an object like this:
<NSAppleEventDescriptor: 'obj '{ 'form':'ID ', 'want':'Subi', 'seld':10900, 'from':'obj '{ 'form':'ID ', 'want':'Elem', 'seld':10900, 'from':null() } }>
Now, I like to resolve that back into an NSObject that represents the actual scripting object of "theArg". How do I do that? I can't find any evaluation functions in NSAppleEventDescriptor
, other than for simple types such as text, numbers and file references.
Upvotes: 0
Views: 113
Reputation: 12095
Turns out I need again a private function that's been mentioned here as well.
@interface NSScriptObjectSpecifier (NSPrivate)
+ (id) _scriptingSpecifierWithDescriptor:(NSAppleEventDescriptor*) descriptor;
@end
With that, I'll get an NSScriptObjectSpecifier
, on which I then invoke objectsByEvaluatingSpecifier
to get my object.
Upvotes: 0