Applescript GUI脚本:无法将按钮转换为UI元素类型

时间:2017-10-10 20:36:03

标签: applescript

我试图用Applescript控制Napkin。它没有内置字典,所以我需要使用GUI脚本。我找到了我要点击的按钮,但是我无法点击它。如何为此按钮编写单击脚本?

使用下面的脚本,我收到此Applescript错误:系统事件出错:无法生成{button"屏幕截图"窗口工具栏1" Napkin"申请流程" Napkin"}进入类型UI元素。

tell application "System Events"
    tell process "Napkin"
        tell toolbar of window 1
            set btnScreenshot to (first button where its title = "Screenshot")
            click btnScreenshot
        end tell
    end tell
end tell

当我在辅助功能检查器中打开此按钮时,该按钮有一个"按下"行动。单击“执行”按钮可运行“屏幕截图”功能 - 就像单击工具栏按钮一样。

enter image description here

我尝试了tell btnScreenshot to perform action "press",但这给了我一个&#34的错误;无法采取行动'按'"。与perform action "AXPress"相同。另外,要求every action of btnScreenshot返回一个空集。

0 个答案:

没有答案