Advertisement

A fix for the Procrastinatr damage

TUAW readers, please accept my deepest apologies again for this Procrastinatr fiasco. As it turns out, most of my iCal calendars are simply subscriptions to my Google Calendars, so I never saw any damage before posting this. Fortunately, however, a commenter on the Procrastinatr post by the name of ejk has put together an AppleScript that can reverse the damage. After creating my own set of local calendars with events and todos, and testing this four times, I am confident that it works. After the jump I have included the script in its entirety, as well as instructions for your inspection. I have also listed instructions for backing up your calendars as they are. If you just want a download, I have also posted a link to a script I compiled myself, after the jump.


The AppleScript fix for Procrastinatr, courtesy of ejk:

set timeBack to (-1 * weeks)
tell application "iCal"
activate
repeat with allCals in calendars
repeat with myEvent in events of allCals
set (start date of myEvent) to ((start date of myEvent) + (my timeBack))
set (end date of myEvent) to ((end date of myEvent) + (my timeBack))
end repeat
repeat with myTodo in todos of allCals
if (due date of myTodo exists) and not (completion date of myTodo exists) then
set due date of myTodo to (due date of myTodo) + timeBack
end if
end repeat
end repeat
end tell

Before you run any of this, I recommend making a backup of your calendars as they are now just in case. Here's how:

- 10.4 stores your calendars in ~/Library/Application Support/iCal.

- 10.3, if I recall, places you calendars in ~/Library/Calendars.

Simply clicking on either of these folders and hit cmd + D, that's a Duplicate command that will create a copy of the folder with "Copy" attached to the name. Back this up, if you want, as you see fit.

To create your own AppleScript, simply go to your Applications/AppleScript folder and open the Script Editor. Copy and paste this text into the editor (everything between the "set timeBack..." line and final "end tell" line) and chose File > Save As. In this dialog, make sure you set the File Format to "Application", and make sure all three of the Options (Run Only, Startup Screen and stay Open) are un-checked. Save this script anywhere you want and then run it. Depending on how large your calendar database is, this could take a little while so I recommend you just sit tight while it's running to keep this by the book.

If you just want this script as a download, I've posted it here.

Again, TUAW readers, please accept my deepest apologies for the mess I helped to make.