通过Applescript在Finder中打开“获取信息”窗口(再次)

时间:2016-05-14 21:14:13

标签: macos applescript finder

网站上有一个关于通过脚本获取文件信息的问题,regulus6633很好地回答了这个问题。提供的解决方案在我的文件夹上工作,但我无法让它在应用程序文件上工作。

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

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

“Finder收到错误:无法获取应用程序”Macintosh HD:应用程序:Google Chrome.app“。

(我是设计师,不是编码员,所以如果答案显而易见,请原谅!)

1 个答案:

答案 0 :(得分:0)

几乎 让它正确,但“几乎”在AppleScript中令人沮丧: - )

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

要获取数据,请使用

而不是打开要查看的窗口
set aFile to (POSIX file "/Applications/Google Chrome.app") as alias
info for aFile