Well I’m still new to AppleScript and am having a bit of difficulty in pulling the “creation” from the metadata tag. What I’m wanting is only the creation date from the EXIF info. Now from a script I found I’m able to get the metadata from a given file:
set the_file to choose file
set {metaDataNames, metaDataValues} to my get_image_info(the_file)
on get_image_info(the_file)
tell application "Image Events"
set the_file to open the_file
return {name of metadata tags of the_file, value of metadata tags of the_file}
end tell
end get_image_info
However, I then get a list, of two lists with strings. How can I return only the creation value? Do I need to return them as above and then try to figure out which item in list 1 goes with list 2? If so… seems like lots of processing, and I’m drawing a blank on that course of action.
If you need the creation date as set by the camera, then try the following:
set the_file to choose file
set {metaDataNames, metaDataValues} to my get_image_info(the_file)
set creationDate to my GetMetaData(metaDataNames, metaDataValues, "creation")
on get_image_info(the_file)
tell application "Image Events"
set the_file to open the_file
return {name of metadata tags of the_file, value of metadata tags of the_file}
end tell
end get_image_info
on GetMetaData(theNames, theValues, wantedValue)
repeat with i from 1 to the number of items in theNames
if item i in theNames is equal to wantedValue then
return item i in theValues
end if
end repeat
return ""
end GetMetaData
It’s not all that much processing really. The lists are small. There may be a better way but I haven’t used Image Events much.