Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Add alarms to all existing iCal birthday events Apps
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: 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.
    •    
  • Currently 2.94 / 5
  You rated: 1 / 5 (17 votes cast)
 
[23,686 views]  

Add alarms to all existing iCal birthday events | 16 comments | Create New Account
Click here to return to the 'Add alarms to all existing iCal birthday events' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Add alarms to all existing iCal birthday events
Authored by: MAddOX on Oct 13, '09 07:44:47AM
There's also a nice little app called Dates2iCal (http://www.nhoj.co.uk/datestoical/) (Shareware 3 UK Pounds). It copies all your birthday calendar entries into any given "normal" calendar adding reminders automatically as you like. It runs automatically in the background. I found this very nice.
(I'm not related to the author of the app, just like to use it.)

[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: rycardo on Oct 13, '09 07:57:56AM
You can also:

...{trigger interval:-(10*days)}

days, hours, and minutes all work within applescript.

HTH

[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: JackSloth on Oct 13, '09 08:39:23AM
When I tried adding ...{trigger interval:-(10*days)} It made all of the alarms 300 days after the event. When I look in the iCal Applescript dictionary it says
display alarmn : This class represents a message alarm.
ELEMENTS
contained by todos, events.

PROPERTIES
trigger interval (integer) : The interval in minutes between the event and the alarm: (positive for alarm that trigger after the event date or negative for alarms that trigger before).

trigger date (date) : An absolute alarm date.


[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: gopes on Oct 13, '09 12:07:59PM
From the hint: "The trigger interval parameter is in minutes; there are 1440 minutes in a day, so -14400 means 10 days before the event. " So, you can't just do "10 * days", because that actually gives you the total number of seconds in 10 days, 864000. Divide that number by 60 to obtain minutes, which is 14400. So, instead of {trigger interval:-(10*days)}, it should be {trigger interval:-((10*days) / (1 * minutes))}. Instead of "(1 * minutes)" you can just put 60, but the long way is more syntax illustrative.

[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: rycardo on Oct 13, '09 06:00:21PM

hey gopes,

good catch!

that's strange that it's in minutes, most time values are in seconds in my experience.

peace



[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: gopes on Oct 13, '09 07:26:20PM

"that's strange that it's in minutes, most time values are in seconds in my experience."

I agree, at first glance; the only thing I can think of is that iCal itself doesn't offer seconds--the options are only as finely grained as minutes in the GUI. (Not that the GUI necessarily restricts other interfaces.)



[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: JackSloth on Oct 13, '09 08:42:27AM

How do you make the alarm "message with sound"? I don't see a reference to that in the AppleScript dictionary for iCal.



[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: rycardo on Oct 13, '09 09:20:52AM

make new sound alarm with properties {trigger interval: XXXX, sound name: XXXX}
trigger date can be substituted for trigger interval, and sound file can be substituted for sound name.

HTH.



[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: jdfrankl on Oct 13, '09 11:15:54AM
The following script creates a message alarm with sound. The problem with this is that since birthdays are all-day events, setting the alarm to go off exactly 10 days in advance means the alarm gets set to go off at midnight. Since I sync my calendar to my iPhone I don't want a sound alarm going off at midnight for a birthday 10 days in the future. To fix that I also changed the alarm interval to 9 days and 16 hours so the alarm gets set to go off at 8 AM instead of midnight.
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 sound alarm at end with properties {trigger interval:-13920}
			end tell
		end repeat
	end tell
end tell


[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: Raminger on Oct 13, '09 09:56:18AM

How can I set 2 alarms, say one 10 days ahead not to forget to send a card and one at the birthday at 10 o clock, so I don't forget to call?



[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: jdfrankl on Oct 13, '09 11:27:12AM
Just add more "make new xxxx alarm" lines to the script with the desired alarm type and interval. This example creates a display alarm 10 days before at 8 AM, a display alarm with sound the day before at 8 AM and a display alarm with sound the day of at 8 AM.
tell application "iCal"
	tell calendar "Birthdays"
		set all_events to every event
		repeat with this_event in all_events
			tell this_event
				delete every display alarm
				delete every sound alarm
				make new display alarm at end with properties {trigger interval:-13920}
				make new sound alarm at end with properties {trigger interval:-960}
				make new sound alarm at end with properties {trigger interval:480}
			end tell
		end repeat
	end tell
end tell


[ Reply to This | # ]
More caveats (Apple bugs)
Authored by: bankshot on Oct 13, '09 11:39:52AM

Since I originally submitted this hint, I've found more ways in which the iCal Birthdays calendar is buggy - at least in Snow Leopard. Specifically, if a birthday event alarm goes off and you select one of the "Repeat in x time..." options, it adds an alarm to that event which can't be deleted via AppleScript. Thus re-running the AppleScript adds even more alarms to the event. Furthermore, any subsequent alarms added via the AppleScript can't be deleted. So if you run the AppleScript multiple times after repeating an alarm, that event will end up having many alarms attached to it.

This bug is somewhat disappointing, because I usually want to repeat a birthday alarm periodically (daily, whatever) until I've done something about it (bought and sent a card, for example). Unfortunately this bug screws up that usage too.

The only way to clear the extra alarms at this point is to uncheck and re-check the "Show birthdays calendar" option in the iCal preferences. You'll then have to re-run the AppleScript to get alarms back. I was hoping to find a way to do this at the front of the AppleScript, but haven't had any luck. Anyone else able to figure it out? The "Record" button in AppleScript Editor seems to do nothing for me.



[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: pub3abn on Oct 13, '09 01:24:04PM
You could also try YABI 3.0 - http://www.devzero.it/YABI_3.0.html

[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: pub3abn on Oct 13, '09 01:27:15PM
Add alarms to all existing iCal birthday events
Authored by: bankshot on Oct 13, '09 10:55:22PM

Yeah, that was one of the options I looked at. Unfortunately, it is PPC only (despite having the "Universal" badge on the download page), and I decided to keep my Snow Leopard machine free from Rosetta. Perhaps it works better than the simple script here.



[ Reply to This | # ]
Add alarms to all existing iCal birthday events
Authored by: suastegui2 on Oct 15, '09 12:54:15PM
just deleted the line 'make new alarm....' in
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:-60}
			end tell
		end repeat
	end tell
end tell
It deletes all alarms, at least in SL.

[ Reply to This | # ]