Select file for deep info

Posted in a news article comments section, moved here for perusal.

OS version: Any

tell application "Finder"
	set mySelect to choose file with prompt "Select file for deep info"
	set myInfo to properties of mySelect as list
	set info to (item 1 of myInfo & " ") as string
	set info to (info & "Name \"" & item 2 of myInfo & "\", ")
	set info to (info & "Path " & item 7 of myInfo & ", ")
	set info to (info & "Logical Size (" & item 15 of myInfo & ") bytes, ")
	set info to (info & "Disk Size (" & item 16 of myInfo & ") bytes, ")
	set info to (info & "Creation Date " & item 17 of myInfo & ", ")
	set info to (info & "Modification Date " & item 18 of myInfo & ", ")
	set info to (info & "Version " & item 30 of myInfo & ", ")
end tell

This is what I use. Short and universal:


tell application "Finder" to properties of item 1 of (get selection)

The original script makes the classic mistake of coercing a record to list and expecting the items to be in a particular order. If you’ve got a record, one should use its labels. It’s safer, easier to use, and easier to read.