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:
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:
Code:
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