How to check for and remove a photo from an iPhoto album using AppleScript
-
09-09-2019 - |
Question
I want to write an AppleScript to import a photo into an album. If a photo with the same file-name already exists in the given album, I want to remove the existing one first, then proceed with the import. I tried:
if album "MyAlbum" contains "pic1.jpg" then
remove "pic1.jpg" from album "MyAlbum"
end if
but that doesn't compile. (I know how to do the actual import part.)
Solution
It turns out the answer is really simple:
remove (every photo of album "MyAlbum" whose image filename is "pic1.jpg")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow