通过 Applescript 在 Finder 中打开 "Get Information" Window(再次)

Open "Get Information" Window in Finder by Applescript (Again)

站点上有一个关于通过脚本获取 file 信息的问题,regulus6633 回答得很好。提供的解决方案适用于文件夹,但我无法使其适用于应用程序文件。

set aFile to (POSIX file "/Applications/Google Chrome.app") as text
tell application "Finder" to open information window of application aFile

据我所知,路径是正确的,但它一直返回语法错误:

"Finder got an error: Can’t get application "Macintosh HD:Applications:Google Chrome.app".

(我是设计师,不是程序员,所以如果答案很明显,请原谅!)

几乎 是对的,但是 "almost" 在 AppleScript 中可能会令人沮丧:-)

set aFile to (POSIX file "/Applications/Google Chrome.app") as alias
tell application "Finder" to open information window of aFile

获取数据,而不是打开window查看,使用

set aFile to (POSIX file "/Applications/Google Chrome.app") as alias
info for aFile