iPhoto Remove Duplicates Script

A few months after I switched from a PC to a Mac, I switched my photo archive from Picasa to iPhoto. But for a while there, I was trying to put my photos in both locations. Then when I started running out of space, I combined my photo albums, but I botched it. My iPhoto folders were full of duplicates and orphan thumbnails. I finally sat down and started sorting…