![Apple 脚本:激活仅在单击按钮后出现的菜单](https://linux22.com/image/1509088/Apple%20%E8%84%9A%E6%9C%AC%EF%BC%9A%E6%BF%80%E6%B4%BB%E4%BB%85%E5%9C%A8%E5%8D%95%E5%87%BB%E6%8C%89%E9%92%AE%E5%90%8E%E5%87%BA%E7%8E%B0%E7%9A%84%E8%8F%9C%E5%8D%95.png)
我正在尝试逐个导出 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