I’m trying to manage my work todos with Apple iCal. I create todo items and completely forget about them after a few minutes :) So i decided to write an AppleScript that periodically sends Growl notifications for uncompleted iCal todo items.
Here it is:
set applicationName to "GrowlTodo"
set allNotifications to { "Todos" }
set defaultNotifications to allNotifications
tell application "GrowlHelperApp" to ¬
register as application applicationName ¬
all notifications allNotifications ¬
default notifications defaultNotifications ¬
icon of application "iCal"
tell application "iCal"
repeat with thisCalendar in calendars
repeat with thisTodo in (every todo of thisCalendar)
if (not (completion date of thisTodo exists)) then
tell thisTodo
set todoSummary to (summary)
end tell
tell application "GrowlHelperApp" to ¬
notify with name "Todos" ¬
title "Todo" description todoSummary ¬
application name applicationName
end if
end repeat
end repeat
end tell
Save this as ~/Scripts/GrowlTodo.scpt (using Script Editor.app) and add following string to your crontab:
*/10 * * * * osascript ~/Scripts/GrowlTodo.scpt
There is an easer way to do almoust the same for me: MenuCalendarClock for iCal http://www.objectpark.net/mcc.html
Hi Ilya, I wanted to thank you for publishing this script. With some help and using your example, I ended up adding this to my launchd to run every 15 minutes. It does almost the same thing as your example except it puts all the “to do” items in one growl notification, and withing growl you can control how many lines will be displayed if you have a large amount.
Here it is:
set applicationName to "GrowlTodo"
set allNotifications to {"Todos"}
set defaultNotifications to allNotifications
tell application "GrowlHelperApp" to ¬
register as application applicationName ¬
all notifications allNotifications ¬
default notifications defaultNotifications ¬
icon of application "iCal"
set TodosNotDone to "" -- this is the string to hold our Growled answer
tell application "iCal"
repeat with thisCalendar in calendars
repeat with thisTodo in (every todo of thisCalendar)
if (not (completion date of thisTodo exists)) then tell thisTodo to set TodosNotDone to TodosNotDone & summary & return
end repeat
end repeat
tell application "GrowlHelperApp" to ¬
notify with name ¬
"Todos" title "You have uncompleted tasks" description TodosNotDone ¬
application name applicationName
end tell