Search code examples
macosapplescriptfinder

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


There's a question on the site about getting file information via script, well answered by regulus6633. The solution provided worked for me on a folder, but I was unable to get it to work similarly on an application file.

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

The path is correct, insofar as I can tell, but it keeps returning the syntax error:

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

(I'm a designer, not a coder, so please excuse if the answer's obvious!)


Solution

  • You almost had it right, but "almost" can be frustrating in AppleScript :-)

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

    To get the data, rather than opening the window to look at, use

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