iCal ToDo scripts

These will be no great shakes for experienced DT Pro users/scripters, but I’ve found these four scripts to be useful. Three of them I scripted by modifying the original so I acknowledge a debt of gratitude to whoever scripted that one. DT Pros newbies like me might find them of use.

Create ToDo for iCal

display dialog "New task : " default answer “”
set myText to the text returned of the result
tell application “iCal”
activate
set newtodo to (make new todo at end of todos of calendar “Writing”)
tell newtodo
set summary to myText
set priority to medium priority
end tell
end tell

Create Next Day ToDo for iCal

display dialog "New task : " default answer “”
set myText to the text returned of the result
tell application “iCal”
activate
set newtodo to (make new todo at end of todos of calendar “Writing”)
tell newtodo
set summary to myText
set priority to high priority
set due date to (current date) + 1 * days
end tell
end tell

Create Next Week ToDo for iCal

–same script as above, just substitute following for last “set”

set due date to (current date) + 1 * weeks

–and change priority to no, low, medium depending upon your preference

Creat ToDo for iCal w/date

display dialog "New task : " default answer “”
set myText to the text returned of the result
display dialog "Due date: " default answer (the date as text)
set myDate to date (text returned of the result)
tell application “iCal”
activate
set newtodo to (make new todo at end of todos of calendar “Writing”)
tell newtodo
set summary to myText
set priority to medium priority
set due date to myDate
end tell
end tell

Here’s another one, which allows you to set the ToDo title, due date, and select the calendar. I haven’t figured out how to make the “choose priority” work, so it’s set to medium. One note: iCal has to be active on the dock for this script to do it’s work. Like I said, I don’t know much scripting yet, so while I know how to activate iCal or launch it, I haven’t figured out how to not do that in the middle of the script. For what it’s worth.

global ICactive

set theDate to short date string of (current date)
–Get event Summary
display dialog “New task:” default answer “”
set myTodo to text returned of the result
–Get date
display dialog “Enter event date:” default answer (theDate as text)
–try
set tdDate to date (text returned of the result)

–check if iCal is active
tell application “System Events”
if exists application process “iCal” then
set ICactive to true
end if
end tell

tell application “iCal”
set myCals to name of every calendar whose writable is true
set theCal to (choose from list myCals with prompt “Attach to calendar” without multiple selections allowed and empty selection allowed) as text
tell calendar theCal
make new todo at end with properties {summary:(myTodo as Unicode text), due date:tdDate, priority:medium priority}
end tell
end tell

  • based on Kevin Bradley’s original script