PDA

View Full Version : Applescript, import img to iPhoto




Gaff
May 14, 2008, 10:37 AM
Hi, I've been trying to put together a script that will import only images to iPhoto.

I have no previous programming experience, I just put this together by pieces I found when I searched for a script like this.

I have a folder I drop random things into, say it's a download folder. I want to attach a folder action to it, that will import _only_ images into iPhoto, and afterwards delete the image. I want it to import only images, because I drop other things into it as well.

This is what I got, but it doesn't work. I was hoping someone more knowledgeable could tell me what's wrong with it. I apologize if it looks silly or stupid, but I just tried to think logically when I put it together. As I said, I'm not a programmer. Anyway, here it is:

on adding folder items to this_folder after receiving added_items
if the name of aFile contains {".jpg"} ¬
or the name of aFile contains {".gif"} ¬
or the name of aFile contains {".png"} ¬
or the name of aFile contains {".pict"} ¬
or the name of aFile contains {".tiff"} ¬
or the name of aFile contains {".gif"} ¬
or the name of aFile contains {".psd"} ¬
or the name of aFile contains {".bmp"} then
tell application "iPhoto"
import from added_items to (the first album whose name is "New images")
delay 5
select (the first album whose name is "New images")
end tell
tell application "Finder" to delete added_items
end if
end adding folder items to



masterp34588
Feb 7, 2009, 04:05 PM
I've just discovered Shovebox (http://www.wonderwarp.com/shovebox/) today. I'm testing it out and my hopes are to have it automatically add any photos I drop onto the menubar icon to my iPhoto library and have a keyword attached. I have no applescript experience at all. This script about the closest thing I've seen after searching around for an hour. I attempted to use this script and I get a successful growl notification and a sound notification but I don't see the file in iPhoto. Is this possible (I imagine I will have to modify the script) and will it work with iPhoto '09?