Extracting WhereFroms Data to a File I see a number of posts on how to delete the WhereFrom extended attributes data, but I would like to do the opposite and extract the information into a file.

I download Creative Commons photos from Flickr and provide photo credits on my blog. 

I would like to set up a Folder Action that extracts the WhereFrom URL from the photo into a file, that way I can easily copy-paste the URL into my blog photo credit. It would also give me an archive of all my downloads.

I tried to reverse-engineer some of the delete scripts on StackExchange but didn't have any luck.
Try this in a Run Applescript Action:

    on run {input, parameters}
    set filePath to "/Users/UserName/Documents/WhereFroms.txt"


    repeat with i from 1 to number of items in input
        set this_item to item i of input
        tell application "Finder" to set displayedname to displayed name of this_item
        set this_item to this_item as string
        set this_item to POSIX path of this_item as string
        set theFroms to (do shell script "mdls -name kMDItemWhereFroms " &amp; quoted form of this_item)
        set allFroms to (do shell script "echo " &amp; quoted form of theFroms &amp; "| cut -d'(' -f2- |cut -d')' -f1 ")--strip crap

        set WhereFroms to "File: " &amp; displayedname &amp; return &amp; "From:  " &amp; (allFroms &amp; return &amp; return)
        do shell script "echo " &amp; quoted form of WhereFroms &amp; "  &gt;&gt; " &amp; quoted form of filePath
    end repeat

end run