在我的sdef中,我有一个接受“Any”类型参数的命令。
在脚本中,我将引用传递给可编写脚本的对象:
tell application "myApp"
set theArg to first subItem of appElement -- appElement is an element of the app object
myCommand theArg
end
在我的命令处理程序代码中,当获取参数时,我得到一个这样的对象:
<NSAppleEventDescriptor: 'obj '{ 'form':'ID ', 'want':'Subi', 'seld':10900, 'from':'obj '{ 'form':'ID ', 'want':'Elem', 'seld':10900, 'from':null() } }>
现在,我想将其解析回一个代表“theArg”的实际脚本对象的NSObject。我怎么做?我在NSAppleEventDescriptor
中找不到任何评估函数,除了简单类型,如文本,数字和文件引用。
答案 0 :(得分:0)
原来我需要一个私密的功能mentioned here。
https://twiter.com/
有了这个,我会得到一个@interface NSScriptObjectSpecifier (NSPrivate)
+ (id) _scriptingSpecifierWithDescriptor:(NSAppleEventDescriptor*) descriptor;
@end
,然后我会调用NSScriptObjectSpecifier
来获取我的对象。