Applescript: Read EXIF data and change "created date"

Discussion in 'Mac Programming' started by katanna, Apr 25, 2009.

  1. katanna macrumors 6502

    katanna

    Joined:
    May 6, 2004
    #1
    Here's the deal. I have a bunch of photos that I have imported and exported out of iPhoto which changed their "created date" in the Finder. However, their "capture date" is still the same in the EXIF data. I would like a quick AppleScript application that will update all of the "created dates" to match the "capture date".

    I have found all of the AppleScript pieces, I just don't know any AppleScript to put them together.

    For example, I found this piece of code that will change a file's "created date", so I know it can be done in AppleScript:

    Code:
    on open files_
    	display dialog "enter the new creation date in format YYYYMMDDhhmm ex: 200112251730:" default answer "" buttons {"Cancel", "Continue"}
    	copy the result as list to {the new_creation_date, the button_pressed}
    	repeat with file_ in files_
    		tell application "Finder"
    			set file_ to POSIX path of file_
    			do shell script "touch -t " & new_creation_date & " " & quoted form of file_
    		end tell
    	end repeat
    end open
    I also have iMagine Photo installed, which can read EXIF data into AppleScript. (Here is their first help page, which is I am sure all you will need.)

    I can tell AppleScript to read the EXIF data, and I can tell AppleScript to change a file's "creation date", I just don't know how to translate the information from one to the other. Can anyone help? Thanks a bunch!

    Matthew
     
  2. Fredzilla macrumors newbie

    Joined:
    Nov 4, 2009
    #2
    Did you ever get an answer to this? I'm trying to do the exact same thing.

    Thanks!
     
  3. autorelease macrumors regular

    Joined:
    Oct 13, 2008
    Location:
    Achewood, CA
    #3
    jhead is a Unix command line utility that can manipulate EXIF data. You can install it with MacPorts or download a prebuilt executable from the website. You can then call jhead from your AppleScript.
     
  4. katanna thread starter macrumors 6502

    katanna

    Joined:
    May 6, 2004
    #4
    I found a program called ShootShifter:

    http://www.maczentrisch.de/shootShifter/

    One of it's features is that it will automatically update the OS X info from the EXIF data. To fix the images, just make sure the program has the correct settings and import the photos into the program. It fixes everything! (Then just quit the program and go along your marry way.)

    Matthew
     
  5. NogbadTheBad macrumors regular

    NogbadTheBad

    Joined:
    Aug 28, 2009
    Location:
    United Kingdom

Share This Page