Apple 脚本:激活仅在单击按钮后出现的菜单

Apple 脚本:激活仅在单击按钮后出现的菜单

我正在尝试逐个导出 Paprika Recipe Manager 中的所有食谱。Paprika 的批量导出功能将它们全部打包成一个文件,这不是我需要的。

下面的代码成功点击了“更多操作”按钮,并显示“更多操作”菜单,但之后我卡住了。如何让 Applescript 点击“导出”按钮?

层次结构以及相关按钮和菜单的屏幕截图

在此处输入图片描述

try
    tell application "Paprika Recipe Manager"
        activate
    end tell
    tell application "System Events"
        tell process "Paprika Recipe Manager"
            --click menu item "Edit" of menu "Connections" of menu bar 1
            click button "More Actions" of window "All-Butter Pie Crust"

            tell menu "More Actions" of button "More Actions"
                click menu item "Export"
            end tell
        end tell
    end tell
    return true
on error error_message
    return false
end try

答案1

您可以尝试以下操作:

代码:

tell application "Paprika Recipe Manager"
    activate
end tell
tell application "System Events"
    tell process "Paprika Recipe Manager"
        tell window 1
            tell button 4
                click
                tell menu 1
                    --PRESS ARROW DOWN 3 TIMES
                    key code 125
                    key code 125
                    key code 125
                    --PRESS ENTER KEY
                    key code 36
                end tell
            end tell
        end tell
    end tell
end tell

相关内容