AppleScript或Automator点击应用程序中的菜单?

use*_*146 5 macos applescript automator excel-2008

我不确定这是否可以通过AppleScript和/或Automator进行...但我希望能够:

a)启动一个应用程序(我知道这可以通过AppleScript或Automator轻松完成)

b)启动应用程序后,使用AppleScript或Automator选择特定的菜单项.

例如,我想启动Excel 2008(我的家庭/学生版本没有为Automator预先配置),然后单击"文件"菜单并单击"打开".

关于去哪里/寻找如何选择这样的菜单项的指针(或者如果它甚至可能的话)?

您可以使用Automator的Record功能"排序",但Record非常脆弱.

我宁愿能够使用AppleScript简单地获取包含应用程序的每个菜单项的"数组",然后以编程方式单击我的数组中的第0个菜单项...等.等等

这可能吗?

TIA

小智 5

tell application "###"

activate

end tell


tell application "System Events"

tell process "###"

click menu item "^^^" of menu "$$$" of menu bar 1

end tell

end tell
Run Code Online (Sandbox Code Playgroud)

将您的应用程序放入### 并将您的菜单项放入^^^ 并将您的菜单(文件、编辑、查看等)放入$$$。资本化问题。

顺便说一句,把它放在applescript中

例子:

tell application "iTunes"

activate

end tell


tell application "System Events"

tell process "iTunes"

click menu item "as list" of menu "view" of menu bar 1

end tell

end tell
Run Code Online (Sandbox Code Playgroud)

删除除 END TELL 和 TELL 应用程序“系统事件”之外的双空格


Pet*_*ron -1

我不知道如何获取数组,但这看起来可能适用于发送鼠标点击等:

虚拟输入