Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

week numbers in ical

Please, why ical doesn't have weeknumbers? It would make this appliaction ten times better as it is now!

macbook pro, Mac OS X (10.5.2)

Posted on Feb 21, 2008 2:40 PM

Reply
7 replies

Mar 3, 2008 1:42 AM in response to Christian Clerx

Hello,

Below is an Applescript that works in Leopard.

It's a modification of a script I've posted here before.
http://discussions.apple.com/thread.jspa?messageID=1030250&#1030250

Best wishes

John M

--Copy below this line into Script Editor and click run --
--Annual Week numbers
--John Maisey
--4/2/5
--Modified for Leopard
--3/3/8
----
set numberOfWeeks to 52 -- change as needed
set daysText to "MonTueWedThuFriSatSun"
set aDate to (current date)
set day of aDate to 1
set month of aDate to January
set aDay to weekday of aDate
set weekNo to 1
--Day of week as num. starting with 0
set aDayText to (characters 1 thru 3 of (aDay as text)) as text
set dayOff to ((offset of aDayText in daysText) - 1) / 3 as integer

if dayOff is less than 5 then
set StartDate to aDate - dayOff * days
else
set StartDate to aDate + (7 - dayOff) * days
end if

tell application "iCal"
set newCal to make new calendar at end of calendars with properties {title:"Week No."}
set myCal to (count of every calendar)
end tell

repeat with myCount from 1 to numberOfWeeks
if (month of StartDate is December) and (day of StartDate is greater than 28) then set weekNo to 1
if (month of StartDate is January) and (day of StartDate is less than 5) then set weekNo to 1
set weekText to "Week No. " & weekNo
tell application "iCal"
tell calendar myCal
make new event at end of events with properties {start date:StartDate, end date:StartDate + (7 * days), allday event:true, summary:weekText}
end tell
end tell
set weekNo to weekNo + 1
set StartDate to StartDate + 7 * days
end repeat
--

May 19, 2008 11:09 PM in response to John Maisey

Thanks to John for this Apple Script. For those who are as ignorant of Apple Script as I am you need to open the "Script Editor.app" that is located in Applications/AppleScript in Leopard 10.5. Follow John's instructions and it will work very nicely. An FYI, what this script does is place the week number in your calendar views as a recurring "all-day" event. You can click on the "event", right click and select "get info" and then change the color of the event so that it is easily differentiated from your other calendars if you use multiple, color coded, calendars like I do.

week numbers in ical

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.