Export iCal To Do items to OmniOutliner

Dec 14, '03 01:47:00AM

Contributed by: Robert Black

iCal's doesn't allow me to print a simple list of all my To Dos as an outline (with no calendar info), so I wrote this Applescript to export all my To Dos into a new outline in OmniOutliner. Each calendar has any associated To Dos indented beneath it.

Personally, I keep the complied script in ~/Library -> Scripts -> Applications -> iCal -> Export iCal todos to OO.scpt, so that it appears in the script menu only when iCal is frontmost...


set theCals to {}
set theTodos to {}

tell application "OmniOutliner"
  activate
  set doc_ID to make new document
  --set doc_ID to document 1
  set isStatusVisible of doc_ID to false
  set topic of row 1 of doc_ID to "Master todo list"
    
  tell application "iCal"
    set theCals to calendars
    set i to 1
    repeat with a_Cal in theCals
      set calTitle to title of calendar i
      my newRow(doc_ID, calTitle, false)
      repeat with aTD in todos of a_Cal
        set TD_name to summary of aTD
        my newRow(doc_ID, TD_name, true)
      end repeat
    set i to i + 1
    end repeat
  end tell
end tell

on newRow(doc_ID, txt, flIndent)
  tell application "OmniOutliner"
    set z to make with properties {topic:txt} new row at end of doc_ID
    indent z
    if flIndent then
      -- there's some sort of bug that doesn't allow
      -- indenting z twice in a row
      set z to last row of doc_ID
      indent z
    end if
  end tell
end newRow
[robg adds: I haven't tested this one.]

Comments (9)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031207021406686