|
|
Another Re-write
Works on the frontmost Finder window. Works on either a Get Info window, or a Finder window with one or more selected files. If Where From metadata isn't available, it will look in the Comment box for a URI.
Save this script into Library/Scripts/Applications/Finder/ and you can easily invoke it from the Finder via the Script Menulet:
tell application "Finder" if the class of window 1 is information window then -- If a Get Info window openURI(item of window 1 as alias, true) of me else if the class of window 1 is Finder window then -- If a regular Finder window repeat with thisItem in the selection as list -- may have multiple files selected openURI(thisItem as alias, true) of me end repeat end if end tell beep (* Grab the WhereFrom metadata; if that fails and "tryComment" is true, try to fetch URI from file's comment box *) on openURI(theFile, tryComment) set theURI to do shell script "mdls -name kMDItemWhereFroms " & quoted form of POSIX path of theFile & " | perl -ne 'print if s/.*"(.*)".*$/\1/'" -- shell script to fetch metadata; using Perl to extract URI from mdls's messy output if theURI ≠ "" then -- did we get a URI? open location theURI else if tryComment = true then -- Look in the file's comment box? tell application "Finder" to set theComment to comment of theFile repeat with thisLine in every paragraph of theComment as list if thisLine starts with "http://" or thisLine starts with "https://" then -- if a comment exists and it looks like it might be a URI, try it open location thisLine end if end repeat end if end openURI |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|