Created
December 27, 2014 22:27
-
-
Save Jonty/13710046bf07263a61b1 to your computer and use it in GitHub Desktop.
An bit of Applescript for use in Automator workflows that takes a list of files and returns a list of files that do not exist in your iPhoto library already, to prevent duplicates being imported.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run {input, parameters} | |
set allFiles to input | |
set newPhotos to {} | |
tell application "iPhoto" | |
repeat with aFile in allFiles | |
try | |
set fileInfo to info for aFile | |
set actualFileName to name of fileInfo | |
set photosFound to get (every photo of album "Photos" whose image filename is actualFileName) | |
end try | |
if length of photosFound is 0 then | |
set newPhotos to newPhotos & {aFile as alias} | |
end if | |
end repeat | |
end tell | |
return newPhotos | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment