Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'iPhoto4 smart albums break desktop picture switching' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
iPhoto4 smart albums break desktop picture switching
Authored by: TALlama on Aug 19, '04 11:57:33AM

This script will choose a random image from the given album and set it as the desktop picture.


#/bin/sh

ALBUM="Backgrounds"

/usr/bin/osascript <<END
    tell application "iPhoto"
        set p_max to the number of photos in album named "$ALBUM"
        set p_num to random number from 1 to p_max
        set the_bg to the image path of photo p_num of album named "$ALBUM"
    end tell
    tell application "Finder"
        -- display dialog "Foo"
        -- set the_bg to ""
        -- display dialog the_bg
        set bg_file to the_bg as POSIX file
        set the desktop picture to bg_file as file
    end tell
END

I have it running in cron as so:

0,10,20,30,40,50 * * * * /Users/tal/Pictures/rotator.sh

This makes my desktop rotate every ten minutes to any picture in my "Backgrounds" smart album. Enjoy!



[ Reply to This | # ]