Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How can I make a slideshow shuffle the pictures in random order?

The slideshow features only displays the photos in the order that they appear in the folder.

It is very important for what I do to be able to randomly shuffle the photos without having to set up or create a project. I just need to click "shuffle" as an option and have it happen. How can I make this happen?

MacBook Pro, Mac OS X (10.7.2)

Posted on Aug 2, 2016 10:23 AM

Reply
7 replies

Jan 2, 2018 4:51 AM in response to schooner85

If you modify the script like this, it will create an album from the list of shuffled photos called "Shuffled Photos Album". You could then try to play this album on the iPad as a slideshow.


-- this script will play the currently selected items as a slideshow and shuffle the items for random results


on getCurrentSelection()

tell application "Photos"

set imageSel to {}

try

set imageSel to (get selection)

on error errTexttwonumbererrNumtwo

display dialog "Cannot get the selection: " & errNumtwo & return & errTexttwo

end try

return imageSel

end tell

end getCurrentSelection


set thephotos to getCurrentSelection()


set nitems to (count of thephotos)

repeat 3 times --shuffle three times for more randomness

if (nitems > 1) then

repeat nitems times --shuffle the photos in the list

set split to random number (nitems - 2) + 1


if (split < 1) then

set split to 1

end if


if split is 1 then

set head to {}

set tail to items 2 thru nitems of thephotos

end if


if split is nitems then

set head to items 1 thru (nitems - 1) of thephotos

set tail to {}

end if


if (split > 1) and (split < nitems) then

set head to items 1 thru (split - 1) of thephotos as list

set tail to items (split + 1) thru nitems of thephotos as list

end if

set thephotos to head & tail & (itemsplit of thephotos as list)

end repeat

end if

end repeat


tell application "Photos"

set ShuffledAlbumName to "ShuffledAlbum" -- change this to the name of the album where you want to save the shuffled list of Photos


try

if not (exists container ShuffledAlbumName) then


makenewalbumnamedShuffledAlbumName

end if

on error errTexttwonumbererrNumtwo

display dialog "Could not create album " & ShuffledAlbumName & errNumtwo & return & errTexttwo

end try

set theShuffledAlbum to containerShuffledAlbumName


addthephotostotheShuffledAlbum




start slideshowusingthephotos as list

end tell

Jan 2, 2018 5:21 AM in response to léonie

A second version:

Adding all photos at once to the album with "addthephotostotheShuffledAlbum" may change the sort order of the list . If the version above does not work, replace the last tell block by:


tell application "Photos"

set ShuffledAlbumName to "ShuffledAlbum" -- change this to the name of the album where you want to save the shuffled list of Photos


try

if not (exists container ShuffledAlbumName) then


makenewalbumnamedShuffledAlbumName

end if

on error errTexttwonumbererrNumtwo

display dialog "Could not create album " & ShuffledAlbumName & errNumtwo & return & errTexttwo

end try

set theShuffledAlbum to containerShuffledAlbumName


-- add thephotos to theShuffledAlbum

repeat with im in thephotos


add {im} totheShuffledAlbum

end repeat




start slideshowusingthephotos as list

end tell

Jan 3, 2018 12:11 AM in response to schooner85

Apple script is rather slow compared to a compiled program. And the algorithm for this script is meant for a small set of pictures. The computation time will grow proportional to the square of the number of selected pictures. If it takes one minute for a hundred pictures, it will take a hundred minutes for a thousand pictures. If you want a slideshow of your complete library, you'd better use the screensaver from Sytem Preferences.

Aug 2, 2016 11:06 AM in response to Kevinloc17

Shuffeling slideshows is not supported in Photos. You could select your album as the source of the screensaver instead and present you slideshow from the screensaver.


Or use an Apple Script to shuffle your photos.


I posted a script as a user tip: Script: Shuffle Photos for an Instant Slideshow in Random Order

It is just a first try on arranging photos randomly.

You could modify it to repeat the shuffling more than once.

How can I make a slideshow shuffle the pictures in random order?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.