iCal ToDo Applescript
iCal ToDo Applescript
I am really enjoying the ical applescript that comes with the the growl app and displays today's events. I was wondering if anyone can write a script that displays todos that are NOT completed?
Here you go:
Code: Select all
-- An applescript that shows uncompleted todos from iCal as growl notifications.
set myAllNotesList to {"ToDos"} as list
set appName to "AppleScript iCal ToDo Notifier"
tell application "GrowlHelperApp" to ¬
register as application appName all notifications myAllNotesList default notifications myAllNotesList icon of application "iCal"
tell application "iCal"
set allCalendars to every calendar
repeat with calIndex from 1 to number of items in allCalendars
set thisCal to item calIndex of allCalendars
tell thisCal
-- get properties
set allToDos to every todo
repeat with todoIndex from 1 to number of items in allToDos
set thisToDo to item todoIndex of allToDos
tell thisToDo
try
if completion date is equal to 0 then
end if
-- If we get this far, then there is a completion date; therefore the todo is completed
-- log ("finished todo")
on error
-- If we are thrown out due to an error, then there is no completion date;
-- therefore the todo is still outstanding
-- log ("unfinished todo!")
set toDoSummary to summary
set toDoDesc to description
try
if toDoDesc is equal to "" then
set toDoDesc to " "
end if
on error
set toDoDesc to " "
end try
tell application "GrowlHelperApp" to ¬
notify with name "ToDos" title toDoSummary description toDoDesc application name appName
end try
end tell
end repeat
end tell
end repeat
end tell