1

是否可以使用 AppleScript 打开最近的文件?我尝试了以下脚本,但它不起作用。

on run
    try
        tell application "System Events"
            set theApp to (get name of first process whose frontmost is true)
            click menu bar item "Archivio" of menu bar 1 of process theApp
            click menu item "Apri recente" of menu "Archivio" of menu bar item "Archivio" of menu bar 1 of process theApp
            click menu item " test" of menu "Apri recente" of menu item "Apri recente" of menu "Archivio" of menu bar item "Archivio" of menu bar 1 of process theApp
        end tell
    end try
end run

错误是

--> 错误号 -1728 来自 «class menE» 的 «class menE» 的 "test" «class menI» 的 "Apri recente" «class menE» 的 "Archivio" «class mbri» 的 "Archivio" «class mbar» 1 of «class prc» "AppleScript Editor"

4

1 回答 1

1

当“ Apri recente ”子菜单打开时,这似乎是一个错误。但这不是必需的,您可以一键完成。

tell application "System Events"
    tell (get first process whose frontmost is true)
        click menu item " test" of menu "Apri recente" of menu item "Apri recente" of menu "Archivio" of menu bar item "Archivio" of menu bar 1
    end tell
end tell
于 2012-08-25T12:41:47.153 回答