Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Export iCal To Do items to OmniOutliner Apps
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.]
    •    
  • Currently 1.00 / 5
  You rated: 1 / 5 (4 votes cast)
 
[16,752 views]  

Export iCal To Do items to OmniOutliner | 9 comments | Create New Account
Click here to return to the 'Export iCal To Do items to OmniOutliner' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Export iCal To Do items to OmniOutliner
Authored by: Son of Pismo on Dec 14, '03 03:42:42AM

Works for me! I am very happy to see OO becoming a real asset to my Mail-Address Book-iCal-iWork workflow! Thx for the script.



[ Reply to This | # ]
Export iCal To Do items to OmniOutliner
Authored by: psandiford on Dec 14, '03 08:13:44AM

For me also. Thx.



[ Reply to This | # ]
Export iCal To Do items to OmniOutliner (update)
Authored by: Robert Black on Dec 14, '03 08:58:29AM
I updated the code slightly so that calendars with zero todos are not included in the outline.

set theCals to {}
set theTodos to {}

tell application "OmniOutliner"
	activate
	set doc_ID to make new document
	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
			set cnt to count of todos of calendar i
			if cnt > 0 then
				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
			end if
			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
			set z to last row of doc_ID
			indent z
		end if
	end tell
end newRow


[ Reply to This | # ]
Export iCal To Do items to OmniOutliner (update)
Authored by: hatchethead on Aug 10, '04 11:35:43AM

Ok, this script is good at doing what it's supposed to do. Now, who can modify this baby to do the following:
(1) report the date on which a to do was completed
(2) limit the report to a range of dates

Such a script would be a wonderful addition to my script collection, and would make iCal a useful app.



[ Reply to This | # ]
Export iCal To Do items to OmniOutliner (update)
Authored by: hatchethead on Aug 10, '04 11:58:02AM

Check this out, too:

http://discussions.info.apple.com/webx?14@249.DJPFa1M5tRm.12@.6896df10/3



[ Reply to This | # ]
Export iCal To Do items to OmniOutliner (update)
Authored by: mstar on Jun 10, '05 04:06:15PM

I am a real newbie to AppleScript, but am REALLY in need of exporting all
my todos.

When I run your script in the editor I get this Error:
Syntax Error
Espected end of line, etc. but found identifier. (then highlights the letter z)

Help?



[ Reply to This | # ]
Export iCal To Do items to OmniOutliner
Authored by: peterrosen on Apr 08, '04 02:13:03PM

It works too well for me! It brings up every to do item even if not visible and completed. Is there a way to have it export only todo items from iCal that are visible?

thanks for the really good script!

peter



[ Reply to This | # ]
Export iCal To Do items to OmniOutliner
Authored by: nestorph on Apr 26, '04 04:38:37PM

Your script looks very tempting but I'm running into two problems when I try and run it:
1) If I try and run it from the pulldown menu under the script symbol while in iCal, it launches OmniOutliner, creates an untitled document and then just sits there after creating a single task title "Master todo list"
2) If I run it from within Script Editor, it launches OmniOutliner and then starts to populate a new document with todo's but then dies with an Applescript error message that says: The variable TD_name is not defined.
Any thoughts?
Thanks for your time
Nestor



[ Reply to This | # ]
Export iCal To Do items to OmniOutliner
Authored by: hizbiz79 on Aug 17, '08 12:57:59PM

Here are a few additions to the script

1. only prints none completed tasks
2. when creating a task in a new row in OO it inherits the color of calendar

I am having an issue with calenders that are listed first in a calendar group, when created in OO they don't inherit the color of the calendar

here it is any help is appreciated:

set theCals to {}
set theTodos to {}

tell application "OmniOutliner Professional"
activate
set doc_ID to make new document

tell application "iCal"
set theCals to calendars
set i to 1
repeat with a_Cal in theCals
set calTitle to title of calendar i
set cnt to count of todos of calendar i
set calcolor to color of calendar i
if cnt > 0 then
my newRow(doc_ID, calTitle, calcolor, false)
repeat with aTD in todos of a_Cal
set TD_name to summary of aTD
set bob to completion date of aTD
try
bob
on error
my newRow(doc_ID, TD_name, calcolor, true)
end try
end repeat
end if
set i to i + 1
end repeat
end tell
end tell

on newRow(doc_ID, txt, clr, flIndent)
tell application "OmniOutliner Professional"
set z to make with properties {topic:txt} new row at end of doc_ID
set color of topic of z to clr
if flIndent then
set z to last row of doc_ID
indent z
end if
end tell
end newRow



[ Reply to This | # ]