iCal and Growl

What should be a relatively simple procedure turns into a bit of a nightmarish hack! I wonder why it is that, although possible to use the "Open File" alarm option and point it at an AppleScript to get a Growl notification, Apple chose not to send any event variables with it? This means it's perfectly feasible to announce "This is a reminder" but it's impossible to discover what the reminder was for without opening iCal!

Thankfully Google came to the rescue and managed to find some clever people who've found a workaround. The example I found on MacOSXHints.com is designed to use sendmail to send event reminders by email - not exactly what I have in mind but the principle's the same. Be warned: this process will permanently replace the Email notification option - take a backup of iCal.app just in case. Here's my step-by-step guide to make Growl notifications work with iCal:

  1. Right-click iCal.app and select "Show package contents"
  2. Open "Contents/Resources/Mail.applescript" with Script Editor
  3. Replace the section which begins with "on send_mail_sbr" with the following code:

    on send_mail_sbr(subjectLine, messageText, myrecipient)
    tell application "GrowlHelperApp" set theName to "New Event" set theAppName to "Custom iCal Notifications" set the allNotificationsList to {theName}
    set the enabledNotificationsList to {theName}
    register as application theAppName ¬
    all notifications allNotificationsList ¬
    default notifications enabledNotificationsList ¬
    icon of application "iCal" notify with name theName ¬
    title subjectLine ¬
    description messageText ¬
    application name theAppName ¬
    with sticky
    end tell
    end send_mail_sbr
  4. Save this applescript using the run-only option and copy the resulting Mail.scpt file back into the package contents folder, overwriting the old one
  5. Repeat steps 1-4 above with the "iCal Helper.app" application file within the same package folder

If you've followed these instructions and everything's gone to plan then event notifications should now work although you'll have to select the "Email" event notification to get a Growl notification and there's no easy way to temporarily restore email notifications again in the future if you need them (unless you kept the backup copy of the unaltered iCal. The next stage is to make it look a little neater:

  1. In the iCal.app package again, open "Contents/Resources/[English].lproj/Localizable.strings" with a basic text editor
  2. Search for '"Email"' and replace the value with "Growl" or whatever you want to appear in the alarm menu. eg: "Email" = "Growl"; then save and close the file
  3. Open "Contents/Resources/[English].lproj/CALLocLayout.plist" with a text editor and comment out "EmailPopup" to get rid of the email address pulldown. eg: <!--string>EmailPopup</string--> then save and close the file
  4. Open "Contents/Resources/[English].lproj/NewInspector.strings" and search for '"Send an email at %@, %d %@ %@"'. Replace the value with something like '"Growl me %2\$d %3\$@ %4\$@ %1\$1.1s"'. eg: "Send an email at %@, %d %@ %@" = "Growl me %2\$d %3\$@ %4\$@ %1\$1.1s";. This tricks the String handler into replacing the email address with a single unicode character. Save and close the file

Note: Replace [English] with your language. You should now have working Growl notifications in iCal with event details. I suspect the changes will vanish next time Apple release an updated iCal, so here's hoping they improve the iCal applescript interface so that I don't have to do this all over again next time.

Stu (not verified) on July 21st 2006

Thanks. Glad it was useful.

Thomas Aylott (not verified) on July 21st 2006

Howdy. Awesome script! I made a modified version of it that lets you still send email. http://subtlegradient.com/articles/2006/07/21/growl-notifications-for-ic... Thanks!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.