这适用于 AppleScript 编辑器:
tell application "Microsoft Outlook" to activate
tell application "System Events"
click menu item "Block Sender" of menu "Junk Mail" of menu item "Junk Mail" of menu "Message" of menu bar item "Message" in menu bar 1 of process "Outlook"
end tell
但是,当我将此脚本移动到 Outlook 的脚本文件夹 ( ~/Library/Application Support/Microsoft/Office/Outlook Script Menu Items/
) 并尝试从 Outlook 的脚本菜单运行它时,出现错误:
系统事件出错:无法获取进程“Outlook”的菜单栏 1。无效索引。
我不应该使用System Events
吗?