Eye Fi Explore Photos uploaded to MobileMe Gallery

I recently purchased an Eye-Fi Explore (http://www.eye.fi/products/explore/) wi-fi enabled SD card for my digital camera.

This product has some great features, including automatic upload of your pictures to your choice of one online photo sharing service selected from an impressive list of services. MobileMe is NOT one of the services offered, however. Another very cool thing the card does, though, is to send the pictures to your home computer and import them into iPhoto, where they will be waiting for you when you return home. So I decided to try using an applescript triggered with a mail rule (you can have the Eye Fi send you an email when your upload is complete) to get my photos automatically uploaded to MobileMe.

Here is what I’ve come up with so far:

1. Prepare iPhoto
a. Create an album called “Uploads” (call it whatever you like and adapt these instructions to your chosen album name)
b. add a photo to the new “Uploads” album (any photo will do)
c. from the “Share” menu, select “MobileMe” and publish your “Uploads” album.
d. Once the “Uploads” album appears under the MobileMe section in your sidebar, you can delete the plain “Uploads” album you created. Also, once the published album has finished uploading, you can at any time remove the sample photo you placed there.

2. Prepare Eye-Fi Manager
a. in Eye-Fi Manager Settings, you must enable Upload to Web and pick a service. It doesn’t matter which. Most are free or have a free version.
b. Next go to Settings > Notifications. Enable email notifications to your email address.

3. Create applescript
a. Launch Script Editor
b. Paste the code below into the script editor:

(*******************************
Eye-Fi to MobileMe Script created by Carl Varney (cvc1968.mac@me.com)
Please keep attribution if redistributed.
*******************************)

(*******************************
Eye-fi creates an album in iPhoto with the current day's date as its name.
So first step is to get today's date and parse it into the same format as the name Eye-Fi will assign to the album.
*******************************)
set m to month of (current date)
set d to day of (current date) as integer

-- add a leading "0" to single digit days
if d < 10 then
	set d to ("0" & d) as string
end if

set y to year of (current date)
set theDate to (m & " " & d & ", " & y) as text

-- we now have set album name that script will look for
set theAlbum to theDate as string


tell application "iPhoto"
	activate
	
	-- we'll set a loop that will make 10 attempts
	set i to 0
	repeat
		
		-- first check if an album with today's date as name exists
		if exists theAlbum then
			set thePhotos to select photos of album theAlbum
			
			-- had to resort to gui scripting here to copy and paste photos from Eye Fi album to Uploads album
			tell application "System Events"
				keystroke "c" using command down
			end tell
			select album "Uploads"
			tell application "System Events"
				keystroke "v" using command down
			end tell
			exit repeat
			
			-- this exits repeat after 10 unsuccessful attempts to find the album
		else if i = 10 then
			exit repeat
		else
			-- if the album isn't found, this will pause 10 sec and then look again
			delay 10
			set i to (i + 1)
		end if
	end repeat
end tell

c. Save as a script to some good location of your choice on your computer.

4. Prepare Apple Mail
a. Go to Preferences and select Rules.
b. Create a new rule. Call it whatever you like.
c. The rule should read as follows:

d. Click OK

Now when Eye fi sends you the email notifying you of a completed upload, the photos will be copied into the published Uploads album which iPhoto will update on MobileMe automatically. And if you add more photos the same day, its OK. An iPhoto album can’t contain duplicates so nothing that was already there during the copy and past process will appear again.

That’s it. It working for me so far. I’m going to keep working on it. I welcome any suggestions for making a more elegant solution. For example, I’d like to find an alternative to the gui scripting.

My next goal is to expand the applescript to export to multiple services (with Eye-fi you can only choose one). I am going to try using a variety of exporter plug ins, and/or the very useful Picturesync application (http://picturesync.net/). Final fallback would be to use each service’s “upload via email” option and mail the new pics there. Any suggestions for making this goal a reality?

Thanks

Model: various
Browser: Safari 523.15
Operating System: Mac OS X (10.5)

Hi,

try this


set theAlbum to do shell script "date +%B' '%d,' '%Y" -- UNIX timestamp


tell application "iPhoto"
	--	activate -- not really needed
	
	-- we'll set a loop that will make 10 attempts
	set i to 10
	repeat while i > 0
		
		-- first check if an album with today's date as name exists
		if exists album theAlbum then
			set thePhotos to photos of album theAlbum
			repeat with onePhoto in thePhotos
				add onePhoto to album "Uploads"
			end repeat
		else
			-- if the album isn't found, this will pause 10 sec and then look again
			delay 10
			set i to i - 1
		end if
	end repeat
end tell

Thanks StefanK,

I have incorporated your date method and your repeat count method.

As far as the method of using ‘add photo’ is concerned… my first use of your script caused an infinite loop in which the photos in the source album kept getting copied over and over again into the “Uploads” album. This resulted in something I did not know was possible. Namely that you can have the same photo repeated more than once within an album. In any case, the addition of an ‘exit repeat’ command solved that issue.

The other problem, which is surprising, is that the Uploads album (as viewed in iPhoto) does not actually show the photos unless you select some other album, then re-select the “Uploads” album. Furthermore, unlike the copy and paste method, this method does not trigger the “Uploads” album to refresh on MobileMe, no matter what I do (short of manually clicking on the little ‘publish’ icon to the left of the album). There does not seem to be any ‘refresh’ or ‘publish’ command for iPhoto in Applescript.

I would certainly prefer to use the add command, so if anyone can find a way to get the published album to refresh on MobileMe, that would be appreciated.

Here is the script as it stands:


(*******************************
Eye-Fi to MobileMe Script created by Carl Varney (cvc1968.mac@me.com)
Thanks to StefanK of Switzerland on MacScripter.net forums for contributions
Please keep attribution if redistributed.
*******************************)

(*******************************
Eye-fi creates an album in iPhoto with the current day's date as its name.
So first step is to get today's date and parse it into the same format as the name Eye-Fi will assign to the album.
Simpler date method by StefanK
*******************************)
set theAlbum to do shell script "date +%B' '%d,' '%Y" -- UNIX timestamp


tell application "iPhoto"
	activate
	
	-- we'll set a loop that will make 10 attempts
	-- Simpler repeat count method by StefanK
	set i to 10
	repeat while i > 0
		
		-- first check if an album with today's date as name exists
		if exists theAlbum then
			set thePhotos to select photos of album theAlbum
			
			-- had to resort to gui scripting here to copy and paste photos from Eye Fi album to Uploads album
			-- other method suggested by StefanK using 'add' command does NOT trigger album to refresh itself on MobileMe
			tell application "System Events"
				keystroke "c" using command down
			end tell
			select album "Uploads"
			tell application "System Events"
				keystroke "v" using command down
			end tell
			exit repeat
			
		else
			-- if the album isn't found, this will pause 10 sec and then look again
			delay 10
			set i to i - 1
		end if
	end repeat
end tell


sorry, I forgot the exit repeat command after copying the photos successfully.
To update the view, select the source album first and after having copied the photos select the “Uploads” album.
I have no idea how to synchronize the album with the gallery. You can click on the “Airport” icon to do it manually
but it’s not accessible by GUI scripting


set theAlbum to do shell script "date +%B' '%d,' '%Y" -- UNIX timestamp

tell application "iPhoto"
	--	activate -- not really needed
	
	-- we'll set a loop that will make 10 attempts
	set i to 10
	repeat while i > 0
		
		-- first check if an album with today's date as name exists
		if exists album theAlbum then
			select album theAlbum
			set thePhotos to photos of album theAlbum
			repeat with onePhoto in thePhotos
				add onePhoto to album "Uploads"
			end repeat
			select album "Uploads"
			exit repeat
		else
			-- if the album isn't found, this will pause 10 sec and then look again
			delay 10
			set i to i - 1
		end if
	end repeat
end tell

Note:

if exists theAlbum

is nonsense, because you check the existence of the literal date string, not of the album :wink:

Good catch Stefan. Thanks again.