Not an answer to the question that you already answered yourself, but just for the archives:
After one has saved a file from a website or an email message, one can use Get Info in Finder to find where a file came from. For an email attachment this shows the message Sender, Subject and the URL referring to that message.
Instead of Get Info, one can also use the command line to get the information:
mdls -name kMDItemWhereFroms <filename>
Using the open
command such URL will make OS X activate the default application, just like it would activate TextEdit for a text file. For message:
URLs, Mail.app will be launched to show the message (if it still exists).
Combined with some AppleScript from the comments at the link above:
on open these_items
set first_item to item 1 of these_items
set full_path to quoted form of POSIX path of first_item
set cmd to ¬
"/usr/bin/mdls -name kMDItemWhereFroms " & ¬
full_path & " | grep 'http:\\|https:\\|message:' | xargs open"
do shell script cmd
end open
Paste the above AppleScript in Script Editor and save it as an Application, with option Run Only. Now, when dragging any file onto that application, the source will be opened, if applicable. I am certainly not an AppleScript expert, and the above does not do any error handling, it simply takes the first file when multiple files are dropped onto the application, and it does not support directories. But one gets the idea, I guess.
(The backslashes in http:\\
above are intentional, and should not read //
. The script searches for http:
, https:
or message:
. In other words: they are not intended to be a part of http://
, but together form an escaped backslash, to escape the pipe-character in the grep
command.)
1This also works in OS X Mavericks where the drag & drop functionality seems to be hit & miss. – Rafael Bugajewski – 2013-08-26T09:51:51.037