如何在AppleScript中单击按钮?

如何在AppleScript中单击按钮?,applescript,buttonclick,image-capture,Applescript,Buttonclick,Image Capture,编写AppleScript以打开Image Capture并单击Import All按钮 tell application "Image Capture" activate tell application "System Events" tell process "Image Capture" click button "Import All" of group 1 of splitter group 1 of w

编写AppleScript以打开Image Capture并单击Import All按钮

tell application "Image Capture"
    activate
        tell application "System Events"
            tell process "Image Capture"
                click button "Import All" of group 1 of splitter group 1 of window 1
            end tell
        end tell
end tell
图像捕获打开,但脚本抛出一条错误消息,表示找不到“全部导入”按钮

我已经遵循了其他线程关于如何在Accessibility Inspector中检查位置以及如何将其转换为AppleScript指令的建议

缺少什么?

对于图像捕获版本6.6,“全部导入”按钮是“窗口1的拆分器组1的组2的按钮3”。此外,我更喜欢使用按钮编号,而不是按钮名称,以确保脚本可以使用任何语言

tell application "Image Capture"
activate
    tell application "System Events"
        tell process "Image Capture"
            click button 3 of group 2 of group 1 of splitter group 1 of window 1
        end tell
    end tell
end tell

请注意,苹果接下来对图像捕获所做的任何更改都将影响您的脚本。

谢谢您,这是可行的。同时也感谢您对使用按钮编号的解释和建议。