iCal ToDo Applescript

The Growl forums have moved to Google Groups, this forum is read only.
Smoohova
Harmless
Posts: 2
Joined: Wed Dec 28, 2005 9:40 pm

iCal ToDo Applescript

Postby Smoohova » Wed Dec 28, 2005 9:43 pm

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?

User avatar
Diggory
Growl Team
Posts: 129
Joined: Sat Dec 04, 2004 12:17 pm
Location: London

Postby Diggory » Wed Jan 04, 2006 3:59 pm

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

User avatar
The_Tick
Cocoaforge Admin
Posts: 4642
Joined: Thu Dec 02, 2004 6:06 am
Contact:

Postby The_Tick » Thu Jan 05, 2006 2:16 am

Woah, Diggory is alive.

Smoohova
Harmless
Posts: 2
Joined: Wed Dec 28, 2005 9:40 pm

Sweet

Postby Smoohova » Thu Jan 05, 2006 5:48 am

Good script, just what I was looking for...

User avatar
Diggory
Growl Team
Posts: 129
Joined: Sat Dec 04, 2004 12:17 pm
Location: London

Postby Diggory » Thu Jan 05, 2006 12:12 pm

Yes, sorry Tick, sort of fell of the edge of the world last year, haven't really touched xcode for about 6 months.

User avatar
The_Tick
Cocoaforge Admin
Posts: 4642
Joined: Thu Dec 02, 2004 6:06 am
Contact:

Postby The_Tick » Thu Jan 05, 2006 3:03 pm

Diggory wrote:Yes, sorry Tick, sort of fell of the edge of the world last year, haven't really touched xcode for about 6 months.



haha, it's alright, just glad you're ok. So what's new?

User avatar
Diggory
Growl Team
Posts: 129
Joined: Sat Dec 04, 2004 12:17 pm
Location: London

Postby Diggory » Thu Jan 05, 2006 8:33 pm

Very little - I've basically been slacking for the last six months. Just turned 30 though (sigh...)


Return to “Growl”

Who is online

Users browsing this forum: No registered users