Add alarms to all existing iCal birthday events

Oct 13, '09 07:30:05AM

Contributed by: bankshot

Beginning with Tiger, iCal added a special built-in Birthdays calendar that creates an event for each birthday that's listed in your Address Book. To enable this, there is a checkbox called Show Birthdays Calendar" in iCal's Preferences (see original hint).

This is handy, but Apple didn't make it nearly as useful as it should be. The events in the Birthdays calendar cannot be edited, so there is no way to set an alarm to remind you about an upcoming birthday ahead of time. This remains true in Snow Leopard. To me, this defeats the purpose of having a Birthdays calendar because I want to be reminded a week or so ahead of time that I need to get a card or whatever.

My search for a better way to handle this found multiple solutions, but this AppleScript by user andrew.bussman in the MacRumors forums seemed to be the simplest and most effective. All credit for coming up with the script goes to andrew.bussman.

For my purposes, I tweaked the script slightly: I wanted a simple message alert without the sound, and I wanted to be notified 10 days ahead of time (to give enough time to buy and send cards to people across the country). Here's the version that I use:

tell application "iCal"
  tell calendar "Birthdays"
    set all_events to every event
    repeat with this_event in all_events
      tell this_event
        delete every sound alarm
        delete every display alarm
        make new display alarm at end with properties {trigger interval:-14400}
      end tell
    end repeat
  end tell
end tell
Just paste the code into AppleScript Editor, save it, and run it as needed. The trigger interval parameter is in minutes; there are 1440 minutes in a day, so -14400 means 10 days before the event.

The only caveat is that any new birthdays you add to your Address Book won't get alarms until you re-run the script. You'll have to remember to do it manually, or there are various ways that it could be automated (say, once a day) if you really wanted.

Comments (16)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20090923134257835