One way to randomize order of an iPhoto slideshow

Mar 12, '08 07:30:04AM

Contributed by: ptone

There are two ways to have a slideshow in iPhoto. From within an album, you can click the Play button and get a quick slideshow. With this method, you have the option to shuffle the order, and play music -- but you can't "fit" the duration of the slideshow to the music.

The other way is to create a slideshow in the sidebar. Here you have the option of setting the duration of each slide to match that of the music (in my case, I had a 20 minute montage), but there is no way to randomize the order -- you have to drag by hand to set the manual order.

My idea is to title the photos with a random number, then sort by title, thereby randomizing the images. Run this AppleScript in Script Editor to do just that:

tell application "iPhoto"
  --tell album "photos"
  -- Note: change the album name above to reflect the album
  -- whose images you'd like to re-title, then remove the "--"
  -- at the beginning of the line. Note that if you leave it
  -- as "photos," then *every* image in your library will be
  -- re-titled!
    repeat with aPhoto in photos
      set title of aPhoto to ((random number 1000) as string)
    end repeat
  end tell
end tell
Note: This solution assumes that you have created a separate iPhoto (v7) library for the slideshow, as it re-titles all the images in the library. It is easy to change this to only randomize a specific album; just change the album name in the script from photos to the album name.

After running the script, select Choose View » sort by » Title in the menu. Then select all, and create a new slideshow in the sidebar. Its order will be randomized.

[robg adds: I modified the script to add the comments and comment out the tell album line. To use the script, please follow the instructions to provide an album name and remove the tell album... line's comment marker. I did it this way because this script will re-title your images, and I didn't want anyone accidentally overwriting their laboriously-applied image titles in their main library. Creating a separate slideshow-only library is the best solution; iPhoto's help explains how to create a new library if you're not familiar with the process.]

Comments (3)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080306101621231