Making daily recurring To Do items in Apple iCal

I just worked out how to use AppleScript to create recurring daily to do items in Apple iCal.

iCal To Do list screenshotIt is the one thing has always prevented my moving over to iCal. I would love to say that it is otherwise, but the fact is, I am terrible at keeping to a rhythm. No matter how firmly I seem to have a simple daily rhythm in grasp I always fall back into my old habits within a few weeks.

To combat this I need a daily checklist. However, this feature is not available in iCal. Disappointed, I looked elsewhere and disliking everything I found, I scrapped my productivity boosting plan entirely and went back to occasionally forgetting my daily list in Omni Outliner.

Yesterday a conversation with a friend pushed me to try this with Automator, which, unfortunately is not suited to the task. Luckily, I recall a long while ago hearing something about an age-old scripting language named "AppleScript".

After taking a half hour to get myself into The Way I finally managed to rustle up a small script that inserted a To Do item into iCal. To my delight it was trivial in iCal to add a recurring 6 am even, which as its alarm, would Run the Script.

Each morning a new daily To Do list item "Fill-in time sheet" is created. This works just as any To Do list item - if I have not completed it by the end of the evening, it will carry on to the following day. I suggest setting 'Hide To Do items _ days after they are complete' to one or two days.

So, without further ado, here's the script:

-- doesn't create duplicates. adds todo's to calendar "Personal"
on createTodo(summaryText)
	set now to current date
	set midnight to now - (time of now)
	tell application "iCal"
		-- don't create an item if it already exists for today!
		if (count (every todo in calendar "Personal"  ¬
					whose due date ≥ midnight  ¬
					and summary = summaryText)) < 1 then
			make new todo  ¬
				at end of calendar "Personal"  ¬
				with properties ¬
				({due date:midnight, summary:summaryText})
		end if
	end tell
end createTodo

createTodo("Fill in time sheet")