Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How can I handle iPhoto's "import duplicates" prompt when using AppleScript folder actions

I'm traveling tomorrow to Europe and am only taking my iPad and camera. I'm planning on using an SD card reader to upload my photos/videos to my iPad, then use Dropbox on the iPad to copy my daily shots to my Dropbox account.


I'm thinking that I'll have an AppleScript on my home computer's /Dropbox/europe/ folder to look for newly added data and then auto import that into iPhoto.


What's the best way to handle this?


I got it working with a couple of test images but when iPhoto sees photos that it's already imported it asks me if I want to import in the duplicates or skip them. I'd like to skip them or write the AppleScript in a way that handles this.


I'm also fine with copying the photos out of the Dropbox folder into a separate folder elsewhere and not using iPhoto.


I'm just trying to theft proof my data in case my iPad gets stolen or if my Dropbox goes goofy and deletes the photos. Maybe copy newly added data to a designated directory outside of the Dropbox folder? How can I do this?


Any suggestions?


I'm running 10.6.8

iMac, Mac OS X (10.6.8)

Posted on Jun 1, 2012 8:26 AM

Reply
Question marked as Best reply

Posted on Jun 1, 2012 8:49 AM

The nature of your question implies that you're unfamiliar with Folder Actions...


I'd like to skip them or write the AppleScript in a way that handles this.


By their very nature, Folder Actions are passed a list of newly-added files. Your Folder Action script should look something like:


on adding folder items tomy_folderafter receivingthe_files


-- your code goes here

end adding folder items to

where, in this case, the_files is a list of the newly-added files. It won't include pre-existing files, so all you need to do is iterate through the_files and you're set. Something like:


on adding folder items tomy_folderafter receivingthe_files

tell application "iPhoto"

repeat with each_photo in the_files

try

import each_photo to album "Europe 2012"

end try

end repeat

end tell

end adding folder items to

The only caveat here that I can think of is the fact it's a DropBox folder, so there might be some odd latency in the files appearing in the directory, but I don't use Dropbox to know.


Note that in the above I import each photo independently, via a repeat loop. This might not be necessary, and you might be able to pass the entire the_files variable to the import command to have all the images imported in one go - I haven't tried that, though.

2 replies
Question marked as Best reply

Jun 1, 2012 8:49 AM in response to alternapop

The nature of your question implies that you're unfamiliar with Folder Actions...


I'd like to skip them or write the AppleScript in a way that handles this.


By their very nature, Folder Actions are passed a list of newly-added files. Your Folder Action script should look something like:


on adding folder items tomy_folderafter receivingthe_files


-- your code goes here

end adding folder items to

where, in this case, the_files is a list of the newly-added files. It won't include pre-existing files, so all you need to do is iterate through the_files and you're set. Something like:


on adding folder items tomy_folderafter receivingthe_files

tell application "iPhoto"

repeat with each_photo in the_files

try

import each_photo to album "Europe 2012"

end try

end repeat

end tell

end adding folder items to

The only caveat here that I can think of is the fact it's a DropBox folder, so there might be some odd latency in the files appearing in the directory, but I don't use Dropbox to know.


Note that in the above I import each photo independently, via a repeat loop. This might not be necessary, and you might be able to pass the entire the_files variable to the import command to have all the images imported in one go - I haven't tried that, though.

How can I handle iPhoto's "import duplicates" prompt when using AppleScript folder actions

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.