an annual calendar somewhere?
zryip.theslug at gmail.com
Sat Feb 27 13:21:06 CST 2010
2010/2/27 Andre.Bisseret <Andre.Bisseret at inria.fr>:
> Bonjour Zryip,
> Starting from your very nice script, I am modifying it so that I obtain one
> month per line.
> I managed to get the days of weeks repeated five times separated by tab in
> the first line of the field (with tab stops in it)
> I suppressed carriage returns and I added "tab" between weeks.
> Not too difficult up to now :-)
> Not completed yet (currently I am getting one month nearly as I expected.
> While doing trials, I just noticed that, when pFirstDayWeek is "Monday", if
> the first day of a month is actually "sunday" then there is a flaw: the "1"
> is set up under "monday" instead of "sunday" while "2" is at its right place
> (second line).
> I got that for example when trying "1/0810" (August 2010)
> This does not happen with pFirstDayWeek = "Sunday" (I tried for months
> beginning a saturday).
> I must confess that I did not study your script deeply
> (I just made few local modifications to quicky obtain a month with an
> aligned format instead of a table.
> So you likely will see faster than me how to fix that issue ;-))
Thanks for your feedback ;)
To fix this bug, replace the pad part by this new portion:
-- Pad beginning with empty days:
put createDate(tYear,tMonthNumber,1) into tStartDay
convert tStartDay to dateitems
get last item of tStartDay
if (pFirstDayWeek is "Monday") then
if (it = 1) then
put 6 into tPad -- fix the case that the day is Sunday (value
1) - 2 = - 1
put (it - 2) into tPad
put (it - 1) into tPad
repeat for tPad
put " " after tCal
> Anyway, thanks a lot for your improvement of the Richard'script; I
> particularly appreciate the possibililty to choose between Sunday and Monday
> as the first day of week. Thanks to your script I am sure I will get the
> format I am expecting.
You're welcome 8-)
Now a little trick with my code. It could give you free times if you
have missed it ;)
How to create an easy loop to add months:
put createDate(2010,1,1) into tStartDate -- Create the January, 1 2010
in your local language system
repeat with tMonthNumber = 0 to 11 -- Create months for January (1) to
put cal(addToDate(tStartDate,0,tMonthNumber,0),"Monday") & cr
after fld "MyField"
-Zryip TheSlug- wish you the best! 8)
More information about the use-livecode