Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

yetiboy

macrumors member
Original poster
Mar 23, 2011
35
0
For a while I've been wanting to come up with a custom slideshow to include on my desktop. Creating a slideshow is simple with Geektool, but I wanted to be selective about the images I was using.

I wanted to be able to use random images from my iPhoto library, but I store my pictures on a portable drive that I don't typically have attached during the day. So in order to have a slideshow of iPhoto images, I needed to take random images from the library and have them copied to a folder on my laptop.

I have this set up so that once daily (using a Calendar event) the script is run as an app. It opens iPhoto, randomly changes the content of an album called Slideshow, exports the album and closes iPhoto. Note that I got the setup for the albums from post #5 at this link:

http://macscripter.net/viewtopic.php?id=41657

I hope someone can put it to good use.

Code:
property num_slides : 50
property ss_name : "Slideshow"
property smartf_name : "NotSlideshow"

-- remove every photo from slideshow album
tell application "iPhoto"
	set temp_ids to id of every photo of album ss_name
	repeat with this_id in temp_ids
		remove photo id this_id from album ss_name
	end repeat
end tell

-- add num_slides random photos to slideshow album
tell application "iPhoto"
	activate
	-- get num_slides random photos
	repeat num_slides times
		set this_id to (id of some photo of album smartf_name)
		add photo id this_id to album ss_name
	end repeat
end tell

set theDestinationFolder to POSIX file "/Path/to/slideshow" as alias

tell application "Finder"
	delete (every item of folder (theDestinationFolder))
end tell

tell application "iPhoto"
	set theImagePaths to image path of photos of album "Slideshow"
end tell

repeat with thisPath in theImagePaths
	set thisFile to POSIX file thisPath as alias
	tell application "Finder" to duplicate thisFile to theDestinationFolder with replacing
end repeat

tell application "iPhoto" to quit

yeti
 
Last edited:

yetiboy

macrumors member
Original poster
Mar 23, 2011
35
0
It appears I've run into a minor problem.

I have this script set to run once a day (overnight). Unfortunately, after I run the script the images no longer appear on my desktop. I have to close Geektool, reopen it and Enable all the geeklets again. I've tried just refreshing, but that doesn't work. I'm assuming the issue comes from having deleted all the existing images in the folder; for some reason Geektool doesn't like it.

Anyone have any idea how to get around this, or is it just an issue with Geektool itself that I'm going to have to live with?

yeti
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.