Set the current day to the middle of iCal's week view

Dec 14, '06 07:30:00AM

Contributed by: JonLaliberte

What this does: When viewing your iCal calendar by the week, the following Applescript simply changes the iCal setting that says which day of the week to start on, such that the current day is always in the middle of the week view.

tell application "System Events" to set isiCalOpen to count ¬
  (every process whose creator type is "wrbt")
if (isiCalOpen is 1) then tell application "iCal" to quit
do shell script ¬
  "defaults write com.apple.ical "first day of week" -int " & ¬
  ((((weekday of (current date)) as integer) + 3) mod 7)
delay 2
tell application "iCal" to activate
If you'd like to use this script regularly, and you're running 10.4, this code can be saved in ~/Library -> LaunchAgents, named org.ANYNAMEHERE.fixicalview.plist (or anything you want, really). This Launch Agent is set to run the included AppleScript every day at 12:01am.

[robg adds: I tested the script, and it works as described.]

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20061210231039985