AppleScript iPhoto import command (how to deal with duplicates)

727 Views Asked by At

I'm trying to fully automate a workflow for getting images into iPhoto. The last piece of the puzzle is handling duplicate images. Currently I see no way in Applescripts import command to not import duplicates. Therefore when a duplicate arrises all workflow stops and iPhoto waits for input.

Is there a way to get through this?

1

There are 1 best solutions below

3
Dude named Ben On

You will need to script this. Here is a bit of code that seems to work inside applescript editor. Adjust accordingly for automator...

set iFolder to (choose folder)

set iFiles to (list folder iFolder)

tell application "iPhoto"
    repeat with iFile in iFiles
        try
            set pFound to get (every photo of album "Photos" whose image filename is iFile)
        end try
        if length of pFound is not 0 then
            log ("File '" & iFile as text) & "' exists..."

            # Move or delete it here
        end if
    end repeat

    # Continue with import
    import from (iFolder as alias)
end tell