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.)
It turns out the answer is really simple:
remove (every photo of album "MyAlbum" whose image filename is "pic1.jpg")