I needed something to create a todo so i would remember to do it weekly.
So here’s a basic script with some settings that can be changed at the top for most of your needs.
set startDate to "26 May 2008"
set endDate to "10 September 2008"
set theCalendar to "Test Calendar"
set theSummary to "Report Due Week "
set theDescription to ""
set theDayOffset to 7
set theUrl to ""
-- 0:no priority; 1:low priority 2:medium priority; 3:high priority
set thePriority to 2
-- set to null if number increment not needed and will not be added to summary
set counter to 1
(* START SCRIPT *)
(* Make these into dates and add 10hours to make sure its the correct day *)
(* I don't know why but it comes up with the correct date but when you relaundh it sets to the previous day even +7h :( *)
try
set startDate to ((date (startDate)) + (3600 * 10))
set endDate to ((date (endDate)) + (3600 * 10))
on error
display dialog "startDate & endDate must be in the format:
22 May 2008"
end try
tell application "iCal"
set priorityList to {no priority, low priority, medium priority, high priority}
repeat until startDate > endDate
try
set a to make new todo at end of todos of calendar theCalendar
on error
make new calendar with properties {name:theCalendar}
set a to make new todo at end of todos of calendar theCalendar
end try
tell a
set summary to theSummary
if counter is not null then -- add the counter if needed
set summary to summary & counter
set counter to counter + 1
end if
set description to theDescription
set url to theUrl
set priority to item thePriority of priorityList
set due date to startDate
set startDate to startDate + (86400 * theDayOffset)
end tell
end repeat
end tell