Batch keyword tagging photos
- 2 minutes read - 398 wordsToday’s problem is tagging large numbers of photos in iPhoto automatically. I have about 2,500 photos in iPhoto, and most of them have tags. But not all of them. So I wanted a way to tell iPhoto to add a tag to a set of photos automatically. Would you believe that it can’t do that?
But, I have a Mac. There must be some way to do this. One of Automator or Script Editor should do this.
They can. I’ll spare you the frantic Googling, the looking for the book on AppleScript that I know I bought, and so on. In the end, I worked out a small script that will do it. Here it is:
tell application "iPhoto"
set thesephotos to selection
assign keyword string "mauvedeity"
end tellThis will add the string “mauvedeity” to the tags on the selected photo or photos. The string has to exist as an iPhoto tag already, or you’ll see an error.
I know it’s basic, but all I wanted to do was to point at an event and add some tags. This actually works, so it’ll do for me. There’s more you can do — this will list out the first picture in the last used album:
tell application "iPhoto"
set albumlist to get the name of every album
set thisAlbum to item 3 of albumlist
set thesephotos to photos of thisAlbum
set thisPhoto to item 1 of thesephotos
display dialog name of thisPhoto as string
end tellI’m now happily tagging away. All I need now is a way to list photos that aren’t tagged, and I’ll be winning!
Seriously, though, I think this is one of the reasons why the Mac is a better platform, and a reason that is bigger than “I like it”. Windows has a scripting framework, but you don’t have a universal scripting mechanism that hooks into most applications. You can do some amazing things with command scripts, PowerShell/Monad and VBA, but those aren’t generic methods. I can’t write a simple script to automate both the shell and Microsoft Office Word in one file, and that is a weakness. Most Windows applications aren’t scriptable at all. I think it’s interesting that I started looking for a way to script this task on the Mac, whereas on Windows I think I’d be resigning myself to doing this by hand.
Any use? Comments? Flames?