AppleScript 术语:定位特定对象的方法

AppleScript terminology: Ways to target a specific object

我正在尝试让这个 AppleScript 与我的可编写脚本的应用程序一起工作:

tell application "My App"
    tell thing 1    -- my custom class
        dosomething -- my custom command
    end tell
end tell

我喜欢影响 "thing 1" 的命令。这可能吗?

或者我是否需要像这样向命令添加参数:

tell application "My App"
    dosomething with thing 1
end tell

不过,我宁愿使用第一个选项。

顺便说一句,如果其他人正在努力使用对象优先命令:将命令的 "class" 字段留空并仅在 <responds-to> 元素中设置方法名称很重要。

使用对象优先命令并实现传递自定义类型的 direct-parameter 键 class。

<responds-to>Cocoa方法接受一个参数

- (void)dosomething:(NSScriptCommand *)command