Suggested Contribution: $ ENDFORM; $donate2 = "
\n"; $donate2 .= "

Please help a small developer making useful stuff

\n"; $donate2 .= $paypalForm; $donate2 .= "
\n\n"; if ($_GET['please'] =='contribute') { $donate = "
\n"; $donate .= "

Help me keep making useful stuff

\n"; $donate .= "

Thank you for using
Joe’s iPhoto AppleScripts!

\n"; $donate .= $paypalForm; $donate .= "

I hope you found these scripts helpful. Your support is greatly appreciated.

"; $donate .= "
\n\n"; }elseif ($_GET['paypal']=='thank_you') { $donate = "
\n"; $donate .= "

Thank you for your support!

"; $donate .= "

Your contribution will help me make more useful stuff and continue to share how I did it.

"; $donate .= "

Thank you and enjoy the scripts!

"; $donate .= "
\n\n"; } else { $donate = $donate2; } ?> Joe’s iPhoto AppleScripts for Date Manipulation

Joe’s iPhoto AppleScripts

Everyone occasionally forgets to set their camera's clock while traveling, not to mention Daylight Savings Time. When several people are sharing photos, camera times are almost never synchronized. Sometimes CRW image dates are off, and movie files often use their import date instead of their true creation date. Also, I often found myself digging through the iPhoto Library looking for original files.

The following four scripts address all of those problems and more. I hope you'll find them as useful as I have.

iPhoto ‘08 finally includes true date shifting! I have some ideas for improvements and additions, but I'm going to be holding off on new scripts for a bit.

iPhoto Date Reset iPhoto Date Reset

Run this to reset the date of selected photos and movies back to their original creation dates. Originally written to fix the movie-import-date bug, it was a huge help in testing the Time Shifter as well.

Photos original dates are from their embedded (EXIF) creation date. Movie dates are taken from the movie's file creation date. Photos without embedded data are skipped. Extracting dates from CRW (raw) images is not working yet.

iPhoto Date Shifter iPhoto Date Shifter

Date Shifter moves whatever date is attached to photo forward or backward in time by days, months or years. This is an adaptation of Time-Shifter, based on feedback from users of several Canon cameras who were experiencing an iPhoto import bug where CRW image dates are off by one month. With this script, just select a bunch of wrongly-dated images and shift them forward one month.

iPhoto Time Shifter Dialog

iPhoto Time Shifter iPhoto Time Shifter

This script adjusts whatever date is already attached to a photo or movie forward or backward in time. Standard Hour:Minute:Second times are recognized but the script adapts to simpler times. For example a a time zone problem can be corrected by just enter the difference in hours.

iPhoto Time Shifter Dialog

Reveal In Finder Reveal In Finder

This script reveals the original file of an image inside the iPhoto Library. If there have been changes to the file, the script offers the choice of revealing the original or currently active copy (with changes applied). It includes a special workaround for the weird way iPhoto renames movies when their dates are changed. This script can also be used to discover unlinked movies or images by revealing their functional neighbors. Use caution when altering iPhoto's Library files.

Installing the Scripts

Installing the scripts is a simple two-step process:

  1. Install Script Menu Activate the Script MenuScript Icon

    Run the small application named "Install Script Menu" from the AppleScript folder inside the Applications folder. The scripts could also be run from Script Editor, but the Script menu is far more convenient. Apple's site has more information about the Script Menu if you'd like to learn more.
    http://www.apple.com/applescript/scriptmenu/

  2. Install the Joe’s iPhoto AppleScripts

    Simply copy the entire "Joe’s iPhoto AppleScripts" folder into your user/Library/Scripts folder. Create the Scripts folder if it doesn't already exist.

    That's it, you should now see the iPhoto scripts in the Menu Bar's Scripts menu and can start using them right away.

10.3 Users will need to enable GUI Scripting (Assistive Devices). Universal AccessFind this at the bottom of the Universal Access pane of System Preferences. Apple's site has more information about enabling GUI Scripting, which allows AppleScripts to control user interface elements. These scripts use this feature to set dates in iPhoto. Only an account with admin priveledges can enable this setting.
http://www.apple.com/applescript/uiscripting/01.html

This function is handled automatically by 10.4.x.

Using the Scripts

To use any of these scripts, select one or more images and movies in iPhoto, then choose a script from the Menu Bar's Script menu.

Date Shifting Months

Date Shifting will roll impossible dates forward to the next month. So trying to shift a photo from March 31 back one month results in March 3 (or March 2 in a leap year), since there is no February 31. Likewise, any 31st day shifted to a 30 day month results in the first day of the next month.

Requirements

Troubleshooting

If you're having trouble with the scripts, please open them in Script Editor, click Run and then send any error messages or highlighted code to . Script execution speed seems to be tied to the size of your iPhoto Library. On test libraries of a few dozen images, shifts are almost instantaneous, but on my main library with 10,000 images, changing the first image can take 30 seconds, most of that is waiting for iPhoto.

iPhoto Movie Date Wackiness

Early versions of iPhoto 5 had a bizarre quirk when changing the dates of a movie; the movie's original file's name is incremented whenever the date is changed. This happens whether using Batch Change or just entering dates/times into the pop-up info pane. After a testing the Date-Shift and Date Reset scripts a few times I had a bunch of movies with absurd file names like "MOV03658_1_1_1_1_1_1_1_1.MPG" (that's a real example). This is doubly-weird behavior since original photos are untouched by date changes.

The only reason I mention this is because iPhoto would occasionally lose the connection to the original source movie causing it to fail to open. The original files are still in the library, they're just somehow unlinked. I found that this generally results from a file-renaming date adjustment, but I haven't been able to pin down what exactly is causing it to happen. Thankfully this is rare, despite testing these scripts on hundreds of my own movies (they're backed up), I only had this happen a few times. I'm fairly sure this is a bug in iPhoto and not the result of my scripts.

How to fix it

Rather than guessing the name iPhoto expects, I found it faster to go dig out the original file and re-import it. The Reveal In Finder script does a good job of guessing which movie is disconnected, so it might turn it up for you without much trouble. Once you've found the original, copy it out of the iPhoto Library, delete it from iPhoto and re-import the movie. Ugly problem, ugly solution.

Scripting Dates in iPhoto

The page explaining my set of AppleScript iPhoto Date Subroutines is out of date. Please feel free to open the scripts in Script Editor and take a look around, I left lots of comments.