I’m looking for a script that will extract whatever metadata exists in an image file to an RTF (like the annotation for PDFs). This is EXIF data like headline, subject, description, [image] keywords, author, etc. Some images have none, others have many elements. The script would extract whatever there is. (I can do all this in exernal image apps, but its a matter of open, find, copy, paste, repeat…)
A simple scripted based on the “Copy Info to Comment” script could look like this:
tell application id "com.devon-technologies.thinkpro2"
try
set this_selection to the selection
if this_selection is {} then error "Please select some images."
repeat with this_item in this_selection
if the type of this_item is equal to picture then
set this_path to the image of this_item
with timeout of 30 seconds
set theComment to ""
tell application "Image Events"
set this_image to open file this_path
set theMDTags to the metadata tags of this_image
repeat with thisMDTag in theMDTags
set theName to name of thisMDTag
set theValue to value of thisMDTag
if class of theValue is string then set theComment to theComment & theName & ": " & theValue & return
end repeat
close this_image
end tell
set the comment of this_item to theComment
end timeout
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
end try
end tell