
I wrote a Python/Applescript to automatically export pics from iPhoto to a photo album, ftp the album to a web site, and generate the link code to the new album needed for a blog post -- all with one click.
My parents just left on an RV trip around the western United States, and wanted a way to post photos from the road (I guess most rv camps have wifi now!). We are mac users, so they use iPhoto. I like the simple look of iPhoto's export to web album feature, but exporting and ftp'ing is a drag. So this program just automates the process. Once you have edited the source file with your ftp info, it's all automatic.
This has only been tested on iPhoto 4 and OSX 10.3 Panther (that's all we got). It uses (evil) GUI scripting extensively, because there's no script support for exporting to web photos in iPhoto (lame, btw).
This script does many applescript things, but is written in Python. It requires
Appscript to run.
To run it, I suggest writing a shellscript with something like this:
pythonw ~/documents/yourscriptfolder/iphoto_to_web.py;exit
and name the file Export_Iphoto.command. The ".command" at the end will let you double click the shell script.
One more gotcha. Cause I was a lazy script-writer, you will need to make a folder in your "Pictures" folder called "iphoto_webgallery" or the script won't work.
Once you have that all setup, select an album in the left pane of iPhoto and run the script. That should be it (god willing).
The script:
iphoto_to_web.py
Comments:
This is awesome! Ever since I forced my wife onto the Mac and iPhoto, she has been griping about how many steps she's got to export photos into an album and transfer to our webdav server (where the album.zip is picked up by another application). On the old PC, I had shell scripts doing all this work. Taking your idea, I could return her one-click convenience of getting new photos onto our family web site.
So python has built-in support for apple GUI objects?
Hmm, think I'm pretty late in responding to this comment.
Anyway, wonder if you ever got a chance to try the script?
Python does not have built-in support for apple GUI scripting, but there is a package you can get called 'appscript' that does. It supports normal applescript, and in addition to that GUI scripting via the accessibility api.
I'm also a fan of appscript, but the lack of scripting support in iPhoto made appscript solutions really fragile in my experience. I wanted to do something similar to your goal -- upload photos to my website -- but instead of using an external script I wrote a generic iPhoto export plugin called ScriptExport. You can look it up on MacUpdate or get it from my website: http://www.n8gray.org/code/scriptexport
Note that it requires iPhoto 5 or newer, so you're probably out of luck if you still haven't upgraded iPhoto. OTOH, the source is available and I'm happy to accept compatibility patches.
Discuss(3)