I had forgotten to set my camera back one hour for the change from Daylight Savings Time in Autumn. I'm a stickler for this, especially when I take some photos on
one camera, and some from my iPhone (on which the time is correct). For
one thing, this causes iPhoto to arrange the photos in the wrong order, as their
timestamps are incorrect.
iPhoto has a 'Batch Change' feature which changes the time/dates on a set of
photos. But is not what I wanted, as that just allows me to specify a
time, and then increment subsequent photos by seconds/hours/days.
This script sets the photo time to one hour earlier than the photo's
current time. It works even across days (i.e. 1st April 2010 00:30H
becomes 31st March 2010 23:30H). It does not modify the file creation
date, but that could be scriptable as well.
The script could also be used to adjust times forward/backward after
travels through different timezones when the camera being used was not set to the local time. Just change the setting of wantedDate to use the offset you need, instead of subtracting 3600 seconds (one hour) as it does now.
Copy and paste the script into AppleScript Editor, and save it with the name of your choice (I called mine 'DST_fix'). If you want it to appear in your Scripts menu put it in the folder ~/Library/Scripts/Applications/iPhoto. You may need to create the iPhoto subfolder first.
tell application "iPhoto" set selPhotos to selection -- create a list out of photos that are selected repeat with eachPhoto in my selPhotos -- tell each photo to do something tell eachPhoto set oldDate to date -- get the date and time of each photo set wantedDate to oldDate - (60 * 60) -- remove 3600 seconds from the time set date to wantedDate -- set new date to each photo end tell end repeat end tell
Mac OS X Hints
http://hints.macworld.com/article.php?story=20100604061926664