10.4: A script to view Spotlight metadata in text files

Jun 14, '05 10:26:00AM

Contributed by: mark hunte

Tiger only hintWhen reading this hint, I realised that to read the metadata of a file(s), I did not always want to go to the Terminal or open the clumsy Get Info window.

So here is a simple script to get the selected file(s) metadata, and open them in a text file. It can be used with most hotkey apps to make it usable via keyboard shortcut:

(* This script will open any selected file/s in finder and do a shell 
   script "mdls" to get the metadata of the file/s, and display the result
   in a Texedit document for each file *)

tell application "Finder"
  set miTem to selection
  repeat with i from 1 to number of items in miTem
    set this_item to item i of miTem as string
    set this_item to POSIX path of this_item
    do shell script "mdls " & quoted form of this_item & " | open -f"
  end repeat
end tell
[robg adds: I tested this one, and it works as described...]

Comments (7)

Mac OS X Hints