当我要求标题而不是价值时,为什么报告“无法获得价值”?

时间:2017-02-03 15:11:55

标签: applescript

这与我最近几个问题中的应用程序代码相同,但是这个版本被重写为在“脚本编辑器”下运行以进行调试帮助。

此代码的最后一行生成错误。使用辅助功能检查器进行检查,所有菜单项都具有NIL值,这就是我专门引用标题的原因。

e.Result

1 个答案:

答案 0 :(得分:0)

由于“选项”变量包含字符串列表,而不是菜单项列表,因此请删除the value of

您可以使用菜单的索引而不是whose子句 - > whose title is equal to (....)

repeat with ndx from 1 to count of choices
    if choices's item ndx is "" then
        tell application "System Events" to tell process "iTunes" to select (menu item (ndx - 1) of menu 1 of pop up button 1 of group 1 of its front window)
        exit repeat
    end if
end repeat