我们正在使用 Applescript 使用 Lightroom 5(CC 的最新版本)开发一个简单的自动化工具。
对于某些操作,我们需要智能收藏面板中的上下文菜单,例如导入智能收藏描述。
根据 stackoverflow 和其他地方的文档和各种来源,AXShowMenu 应该会显示该菜单。
到目前为止,我还无法弹出该上下文菜单。
使用 UIElementInspector 和 UI 浏览器,我找到了附加了 AXShowMenu 操作的元素。根据 UI Browser 提供的代码,我得到了以下脚本,我从 Applescript 编辑器运行:
tell application "Adobe Photoshop Lightroom 5"
activate
tell application "System Events"
tell process "Lightroom"
set frontmost to true
perform action 1 of static text "Smart Collections" of group 1 of row 11 of outline 1 of scroll area 1 of window 6
delay 2
end tell
end tell
end tell
tell application "AppleScript Editor" to activate
请注意,如果您尝试重新创建它,则窗口数和行数可能会有所不同。此外,最后一行只是为了方便,与代码无关。
在 AppleScript 编辑器的结果窗口中,我有以下内容:
perform action 1 of static text "Smart Collections" of group 1 of row 11 of outline 1 of scroll area 1 of window 6 of process "Lightroom"
--> action "AXShowMenu" of static text "Smart Collections" of group 1 of row 11 of outline 1 of scroll area 1 of window 6 of application process "Adobe Photoshop Lightroom 5"
这意味着我确实调用了该操作。
但是……什么也没有发生。
任何见解,解决方法等都受到高度赞赏。
提前致谢。