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


Click here to return to the 'Add To Dos to iCal from a text file using AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Add To Dos to iCal from a text file using AppleScript
Authored by: smoohova on Feb 22, '07 10:13:16AM

Here's a script that I modified from the Quicksilver Forums:

set iCalendars to {}
set theCals to {}
set priList to {"None", "Very Important", "Important", "Not Important"}
set priNums to {0, 3, 5, 9}

tell application "iCal"
set theCals to calendars whose writable is true
repeat with i from 1 to count of theCals
copy title of item i of theCals to end of iCalendars
end repeat
end tell


tell application "Quicksilver" to activate
display dialog "Enter toDo Summary: " default answer ""
set theSummary to the text returned of the result

display dialog "Enter toDo Description:" default answer ""
set theDescription to the text returned of the result

set theChoice to choose from list iCalendars with prompt "Choose the Calendar to use" OK button name "Choose" without multiple selections allowed and empty selection allowed

if theChoice is not false then
set theCalChoice to item 1 of theChoice
end if

set theCalName to theCalChoice



-- Run through our Calendar list and find the iCal id of the chosen Calendar
set i to 1
repeat with anitem in iCalendars
if item i of iCalendars is equal to theCalName then
set theNum to i
exit repeat
end if
set i to i + 1
end repeat

set currentCal to item theNum of theCals

tell application "iCal"
make todo at end of todos of currentCal with properties {priority:3, summary:theSummary, description:theDescription}
end tell


First, it will ask you to put the title of the Todo, then it will ask if you want to put any notes in it, and then it will finally display a list of calendars you have that you want to add the todo to.



[ Reply to This | # ]