#!/bin/sh # MetaCard 2.4 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" UnixCal3",--Examples for calendar files: -- --LANG=C --Easter=Ostern -- --6/15 June 15 (if ambiguous, will default to month/day). --Jun. 15 June 15. #--15 June June 15. #--Thursday Every Thursday. #--June Every June 1st. #--15 * 15th of every month. -- --May Sun+2 second Sunday in May (Muttertag) --04/SunLast last Sunday in April, -- summer time in Europe --Easter Easter #--Ostern-2 Good Friday (2 days before Easter) #--Paskha Orthodox Easter on preOpenStack if the short name of this stack = "UnixCal" then loadPrefs end if end preOpenStack on shutdownRequest pass shutDownRequest end shutdownRequest on closeStack if the short name of this stack = "UnixCal" then savePrefs put empty into fld "Today" put empty into fld "ShownDate" if the environment = "development" then save this stack end if end closeStack on resume resumeStack end resume on resumeStack if the short name of this stack = "UnixCal" then put getDisplayedDate into tDate convert tDate to short English date put the seconds into tNow convert tNow to short English date if tDate <> tNow then if the number of words in fld "ShownDate" = 2 then send mouseUp to btn "This month" else send mouseUp to btn "Today" end if end if end if end resumeStack on savePrefs put specialFolderPath("Preferences") & "/UnixCal.prefs" into tPath put the width of window "UnixCal" & cr into tPrefs put the height of window "UnixCal" & cr after tPrefs put the topLeft of window "UnixCal" & cr after tPrefs if the number of words in fld "ShownDate" = 2 then put "Month" & cr after tPrefs else put "Day" & cr after tPrefs end if put the cShowButtons of me & cr after tPrefs put tPrefs into URL ("file:" & tPath) end savePrefs on loadPrefs put specialFolderPath("Preferences") & "/UnixCal.prefs" into tPath if there is not a file tPath then set the cShowButtons of me to true toggleButtonDisplay send mouseUp to btn "Today" exit loadPrefs end if put URL ("file:" & tPath) into tPrefs put line 1 of tPrefs into tW put line 2 of tPrefs into tH set the width of window "UnixCal" to tW set the height of window "UnixCal" to tH set the topleft of window "UnixCal" to line 3 of tPrefs if line 4 of tPrefs = "Month" then send mouseUp to btn "This month" else send mouseUp to btn "Today" end if set the cShowButtons of me to line 5 of tPrefs toggleButtonDisplay send "resetWindow " & tW & comma & tH to me in 5 ticks end loadPrefs on resetWindow pW, pH revChangeWindowSize pW, pH resizeStack pW, pH end resetWindow function listCalendars put the defaultFolder into oldDefault set the defaultFolder to "/usr/share/calendar/" put the files into tList filter tList with "*calendar.*" put empty into tDateList repeat for each line L in tList put URL ("file:" & L) into tDates filter tDates with "*" & tab & "?*" filter tDates with "?*" put tDates & cr after tDateList end repeat set the defaultFolder to oldDefault put empty into tNew set the itemDel to tab repeat for each line L in tDateList if L is empty then next repeat if item 1 of L is empty then put space & item 2 of L after last line of tNew else put L & cr after tNew end repeat delete last char of tNew return tNew end listCalendars function filterDate pDate, pFullMonth put listCalendars() into tList -- extract various bits of date info put pDate into tNow convert tNow from short English date to dateItems put item 1 of tNow into tYear put item 2 of tNow into tMonthNum put line tMonthNum of the monthNames into tLongMonth put line tMonthNum of the abbrev monthNames into tShortMonth if tMonthNum < 10 then put "0" before tMonthNum put item 3 of tNow into tDateNum if tDateNum < 10 then put "0" before tDateNum put item 7 of tNow into tWeekDayNum put line tWeekDayNum of the weekdayNames into tLongDay put line tWeekDayNum of the abbrev weekdayNames into tShortDay -- replace Easter related dates with real dates for the current year put calcEaster(tYear) into easterDate put easterDate & "/" & tYear into tFullEaster convert tFullEaster to dateItems put empty into tNew set the itemDel to tab repeat for each line L in tList if item 1 of L contains "Easter" then put item 1 of L into d replace "Easter" with "" in d if d is not empty then set the itemDel to comma put tFullEaster into newD add d to item 3 of newD convert newD to seconds convert newD to dateItems put item 2 of newD into newM if newM < 10 then put "0" before newM put item 3 of newD into newD if newD < 10 then put "0" before newD put newM & "/" & newD into d set the itemDel to tab else put easterDate into d end if put d & tab & item 2 of L & cr after tNew else put L & cr after tNew end if end repeat delete last char of tNew put tNew into tList -- reduce list to current month only replace tShortMonth & ". " with tMonthNum & "/" in tList replace tShortMonth & space with tMonthNum & "/" in tList replace tLongMonth & "." with tMonthNum & "/" in tList filter tList with tMonthNum & "/*" -- convert weekday dates to real dates put empty into tNew repeat for each line L in tList set the itemDel to tab put item 1 of L into d set the itemDel to "/" put item 2 of d into w set the itemDel to tab -- ignore variable dates if last char of w = "*" then next repeat if w is not a number then put relativeDate(w, tMonthNum, tYear) into newDate put newDate & tab & item 2 of L & cr after tNew else put L & cr after tNew end if end repeat delete last char of tNew if pFullMonth <> true then filter tNew with tMonthNum & "/" & tDateNum & tab & "*" end if sort lines of tNew return tNew end filterDate function calcEaster pYear -- [in] wYear - 4-digit year to calculate (but not before 1583) -- [out] wMonth - month of easter sunday -- [out] wDay - day of easter sunday put 0 into wCorrection if( pYear < 1700 ) then put 4 into wCorrection else if pYear < 1800 then put 5 into wCorrection else if pYear < 1900 then put 6 into wCorrection else if pYear < 2100 then put 0 into wCorrection else if pYear < 2200 then put 1 into wCorrection else if pYear < 2300 then put 2 into wCorrection else if pYear < 2500 then put 3 into wCorrection put (19 * (pYear mod 19) + 24) mod 30 into wDay put 22 + wDay + ((2 * (pYear mod 4) + 4 * (pYear mod 7) + 6 * wDay + 5 + wCorrection) mod 7) into wDay -- jump to next month if wDay > 31 then put 4 into wMonth subtract 31 from wDay else put 3 into wMonth end if if wMonth < 10 then put "0" before wMonth if wDay < 10 then put "0" before wDay return wMonth & "/" & wDay end calcEaster -- pDate is in a format where the first 3 chars are the abbreviated day name -- the remainder is either First, Second, Third, Fourth, Last -- or +1, +2, +3, +4 for 1st, 2nd, 3rd & 4th -- function relativeDate pDate, pMonth, pYear -- extract the day name & convert to a number put char 1 to 3 of pDate into tDayName put the abbrev weekDayNames into tDayList get lineOffset(tDayName, tDayList) if it = 0 then return empty put it into tDayNum put char 4 to -1 of pDate into tSet if char 1 of tSet = "+" then delete char 1 of tSet -- find first whatever day in the month put pMonth & "/1/" & pYear into firstDate convert firstDate to dateItems put last item of firstDate into firstDayNum put tDayNum - firstDayNum into dayDiff if dayDiff < 0 then add 7 to dayDiff add dayDiff to item 3 of firstDate convert firstDate to seconds convert firstDate to dateItems -- add weeks as necessary switch tSet case "First" case "1" break case "Second" case "2" add 7 to item 3 of firstDate break case "Third" case "3" add 14 to item 3 of firstDate break case "Fourth" case "4" add 21 to item 3 of firstDate break case "Fifth" case "5" add 28 to item 3 of firstDate break case "Last" -- try week 5 and if that doesn't work, use week 4 put firstDate into testDate add 28 to item 3 of testDate convert testDate to seconds convert testDate to dateItems if item 2 of testDate = pMonth then put testDate into firstDate else add 21 to item 3 of firstDate end if break end switch convert firstDate to seconds convert firstDate to dateItems put item 2 of firstDate into newM put item 3 of firstDate into newD if newM < 10 then put "0" before newM if newD < 10 then put "0" before newD return newM & "/" & newD end relativeDate on showDisplayedDate pDate, pIsMonth if pIsMonth = true then convert pDate from short English date to dateItems put item 2 of pDate into monthNum put line monthNum of the system monthNames & space & item 1 of pDate into fld "ShownDate" else convert pDate from short English date to long system date put pDate into fld "ShownDate" end if set the hilitedLine of fld "Today" to empty end showDisplayedDate function getDisplayedDate put fld "ShownDate" into tDate if the number of words in tDate = 2 then -- showing month & year only put word 1 of tDate into monthName put lineOffset(monthName, the system monthNames) into monthNumber put word 2 of tDate & comma & monthNumber & comma & "1,0,0,0,0" into newDate convert newDate from dateItems to short system date convert newDate from short system date to dateItems return newDate else -- showing long system date convert tDate from long system date to dateItems return tDate end if end getDisplayedDate on resizeStack newW, newH, oldW, oldH set the width of fld "ShownDate" to newW - 32 set the topLeft of fld "ShownDate" to "16,28" if the cShowButtons of me = true then put 118 into tBase else put 50 into tBase set the width of fld "Today" to newW - 32 set the height of fld "Today" to newH - tBase set the topLeft of fld "Today" to "16,58" if the cShowButtons of me = false then exit resizeStack set the loc of btn "Previous Day" to "76," & newH - 38 set the loc of btn "Previous Month" to "76," & newH - 4 set the loc of btn "Today" to (newW div 2 & comma & newH - 38) set the loc of btn "This month" to (newW div 2 & comma & newH - 4) set the loc of btn "Next Day" to (newW - 76 & comma & newH - 38) set the loc of btn "Next Month" to (newW -76 & comma & newH - 4) end resizeStack on toggleButtonDisplay lock screen if the cShowButtons of me = true then show grp "Buttons" put "Hide buttons/B" into line 9 of btn "File" else hide grp "Buttons" put "Show buttons/B" into line 9 of btn "File" end if resizeStack the width of this stack, the height of this stack if the cShowButtons of me = true then unlock screen with visual effect wipe up very fast else unlock screen with visual effect wipe down very fast end if end toggleButtonDisplay on clearAll put empty into fld "ShownDate" put empty into fld "Today" end clearAll 聁q cShowButtonsfalseUnix Calendar UVerdana UVerdana WVerdanaWVerdana ULucida Grande ucMenubarcREVGeometryCachestackID1018 cREVGeneral scriptChecksumf ۛqd9R$ debugObjects handlerListpreOpenStack shutdownRequest closeStack resume resumeStack savePrefs loadPrefs resetWindow listCalendars filterDate calcEaster relativeDate showDisplayedDate getDisplayedDate resizeStack toggleButtonDisplay clearAll breakPointsscriptSelectionchar 4914 to 4913 bookmarks prevHandler filterDate tempScriptscript}

--Examples for calendar files:

--

--LANG=C

--Easter=Ostern

--

--6/15 June 15 (if ambiguous, will default to month/day).

--Jun. 15 June 15.

#--15 June June 15.

#--Thursday Every Thursday.

#--June Every June 1st.

#--15 * 15th of every month.

--

--May Sun+2 second Sunday in May (Muttertag)

--04/SunLast last Sunday in April,

-- summer time in Europe

--Easter Easter

#--Ostern-2 Good Friday (2 days before Easter)

#--Paskha Orthodox Easter

on preOpenStack

if the short name of this stack = "UnixCal" then

loadPrefs

end if

end preOpenStack

on shutdownRequest

pass shutDownRequest

end shutdownRequest

on closeStack

if the short name of this stack = "UnixCal" then

savePrefs

put empty into fld "Today"

put empty into fld "ShownDate"

if the environment = "development" then save this stack

end if

end closeStack

on resume

resumeStack

end resume

on resumeStack

if the short name of this stack = "UnixCal" then

put getDisplayedDate into tDate

convert tDate to short English date

put the seconds into tNow

convert tNow to short English date

if tDate <> tNow then

if the number of words in fld "ShownDate" = 2 then

send mouseUp to btn "This month"

else

send mouseUp to btn "Today"

end if

end if

end if

end resumeStack

on savePrefs

put specialFolderPath("Preferences") & "/UnixCal.prefs" into tPath

put the width of window "UnixCal" & cr into tPrefs

put the height of window "UnixCal" & cr after tPrefs

put the topLeft of window "UnixCal" & cr after tPrefs

if the number of words in fld "ShownDate" = 2 then

put "Month" & cr after tPrefs

else

put "Day" & cr after tPrefs

end if

put the cShowButtons of me & cr after tPrefs

put tPrefs into URL ("file:" & tPath)

end savePrefs

on loadPrefs

put specialFolderPath("Preferences") & "/UnixCal.prefs" into tPath

if there is not a file tPath then

set the cShowButtons of me to true

toggleButtonDisplay

send mouseUp to btn "Today"

exit loadPrefs

end if

put URL ("file:" & tPath) into tPrefs

put line 1 of tPrefs into tW

put line 2 of tPrefs into tH

set the width of window "UnixCal" to tW

set the height of window "UnixCal" to tH

set the topleft of window "UnixCal" to line 3 of tPrefs

if line 4 of tPrefs = "Month" then

send mouseUp to btn "This month"

else

send mouseUp to btn "Today"

end if

set the cShowButtons of me to line 5 of tPrefs

toggleButtonDisplay

send "resetWindow " & tW & comma & tH to me in 5 ticks

end loadPrefs

on resetWindow pW, pH

revChangeWindowSize pW, pH

resizeStack pW, pH

end resetWindow

function listCalendars

put the defaultFolder into oldDefault

set the defaultFolder to "/usr/share/calendar/"

put the files into tList

filter tList with "*calendar.*"

put empty into tDateList

repeat for each line L in tList

put URL ("file:" & L) into tDates

filter tDates with "*" & tab & "?*"

filter tDates with "?*"

put tDates & cr after tDateList

end repeat

set the defaultFolder to oldDefault

put empty into tNew

set the itemDel to tab

repeat for each line L in tDateList

if L is empty then next repeat

if item 1 of L is empty then put space & item 2 of L after last line of tNew

else put L & cr after tNew

end repeat

delete last char of tNew

return tNew

end listCalendars

function filterDate pDate, pFullMonth

put listCalendars() into tList

-- extract various bits of date info

put pDate into tNow

convert tNow from short English date to dateItems

put item 1 of tNow into tYear

put item 2 of tNow into tMonthNum

put line tMonthNum of the monthNames into tLongMonth

put line tMonthNum of the abbrev monthNames into tShortMonth

if tMonthNum < 10 then put "0" before tMonthNum

put item 3 of tNow into tDateNum

if tDateNum < 10 then put "0" before tDateNum

put item 7 of tNow into tWeekDayNum

put line tWeekDayNum of the weekdayNames into tLongDay

put line tWeekDayNum of the abbrev weekdayNames into tShortDay

-- replace Easter related dates with real dates for the current year

put calcEaster(tYear) into easterDate

put easterDate & "/" & tYear into tFullEaster

convert tFullEaster to dateItems

put empty into tNew

set the itemDel to tab

repeat for each line L in tList

if item 1 of L contains "Easter" then

put item 1 of L into d

replace "Easter" with "" in d

if d is not empty then

set the itemDel to comma

put tFullEaster into newD

add d to item 3 of newD

convert newD to seconds

convert newD to dateItems

put item 2 of newD into newM

if newM < 10 then put "0" before newM

put item 3 of newD into newD

if newD < 10 then put "0" before newD

put newM & "/" & newD into d

set the itemDel to tab

else

put easterDate into d

end if

put d & tab & item 2 of L & cr after tNew

else

put L & cr after tNew

end if

end repeat

delete last char of tNew

put tNew into tList

-- reduce list to current month only

replace tShortMonth & ". " with tMonthNum & "/" in tList

replace tShortMonth & space with tMonthNum & "/" in tList

replace tLongMonth & "." with tMonthNum & "/" in tList

filter tList with tMonthNum & "/*"

-- convert weekday dates to real dates

put empty into tNew

repeat for each line L in tList

set the itemDel to tab

put item 1 of L into d

set the itemDel to "/"

put item 2 of d into w

set the itemDel to tab

-- ignore variable dates

if last char of w = "*" then next repeat

if w is not a number then

put relativeDate(w, tMonthNum, tYear) into newDate

put newDate & tab & item 2 of L & cr after tNew

else

put L & cr after tNew

end if

end repeat

delete last char of tNew

if pFullMonth <> true then

filter tNew with tMonthNum & "/" & tDateNum & tab & "*"

end if

sort lines of tNew

return tNew

end filterDate

function calcEaster pYear

-- [in] wYear - 4-digit year to calculate (but not before 1583)

-- [out] wMonth - month of easter sunday

-- [out] wDay - day of easter sunday

put 0 into wCorrection

if( pYear < 1700 ) then put 4 into wCorrection

else if pYear < 1800 then put 5 into wCorrection

else if pYear < 1900 then put 6 into wCorrection

else if pYear < 2100 then put 0 into wCorrection

else if pYear < 2200 then put 1 into wCorrection

else if pYear < 2300 then put 2 into wCorrection

else if pYear < 2500 then put 3 into wCorrection

put (19 * (pYear mod 19) + 24) mod 30 into wDay

put 22 + wDay + ((2 * (pYear mod 4) + 4 * (pYear mod 7) + 6 * wDay + 5 + wCorrection) mod 7) into wDay

-- jump to next month

if wDay > 31 then

put 4 into wMonth

subtract 31 from wDay

else

put 3 into wMonth

end if

if wMonth < 10 then put "0" before wMonth

if wDay < 10 then put "0" before wDay

return wMonth & "/" & wDay

end calcEaster

-- pDate is in a format where the first 3 chars are the abbreviated day name

-- the remainder is either First, Second, Third, Fourth, Last

-- or +1, +2, +3, +4 for 1st, 2nd, 3rd & 4th

--

function relativeDate pDate, pMonth, pYear

-- extract the day name & convert to a number

put char 1 to 3 of pDate into tDayName

put the abbrev weekDayNames into tDayList

get lineOffset(tDayName, tDayList)

if it = 0 then return empty

put it into tDayNum

put char 4 to -1 of pDate into tSet

if char 1 of tSet = "+" then delete char 1 of tSet

-- find first whatever day in the month

put pMonth & "/1/" & pYear into firstDate

convert firstDate to dateItems

put last item of firstDate into firstDayNum

put tDayNum - firstDayNum into dayDiff

if dayDiff < 0 then add 7 to dayDiff

add dayDiff to item 3 of firstDate

convert firstDate to seconds

convert firstDate to dateItems

-- add weeks as necessary

switch tSet

case "First"

case "1"

break

case "Second"

case "2"

add 7 to item 3 of firstDate

break

case "Third"

case "3"

add 14 to item 3 of firstDate

break

case "Fourth"

case "4"

add 21 to item 3 of firstDate

break

case "Fifth"

case "5"

add 28 to item 3 of firstDate

break

case "Last"

-- try week 5 and if that doesn't work, use week 4

put firstDate into testDate

add 28 to item 3 of testDate

convert testDate to seconds

convert testDate to dateItems

if item 2 of testDate = pMonth then

put testDate into firstDate

else

add 21 to item 3 of firstDate

end if

break

end switch

convert firstDate to seconds

convert firstDate to dateItems

put item 2 of firstDate into newM

put item 3 of firstDate into newD

if newM < 10 then put "0" before newM

if newD < 10 then put "0" before newD

return newM & "/" & newD

end relativeDate

on showDisplayedDate pDate, pIsMonth

if pIsMonth = true then

convert pDate from short English date to dateItems

put item 2 of pDate into monthNum

put line monthNum of the system monthNames & space & item 1 of pDate into fld "ShownDate"

else

convert pDate from short English date to long system date

put pDate into fld "ShownDate"

end if

set the hilitedLine of fld "Today" to empty

end showDisplayedDate

function getDisplayedDate

put fld "ShownDate" into tDate

if the number of words in tDate = 2 then

-- showing month & year only

put word 1 of tDate into monthName

put lineOffset(monthName, the system monthNames) into monthNumber

put word 2 of tDate & comma & monthNumber & comma & "1,0,0,0,0" into newDate

convert newDate from dateItems to short system date

convert newDate from short system date to dateItems

return newDate

else

-- showing long system date

convert tDate from long system date to dateItems

return tDate

end if

end getDisplayedDate

on resizeStack newW, newH, oldW, oldH

set the width of fld "ShownDate" to newW - 32

set the topLeft of fld "ShownDate" to "16,28"

if the cShowButtons of me = true then put 118 into tBase

else put 50 into tBase

set the width of fld "Today" to newW - 32

set the height of fld "Today" to newH - tBase

set the topLeft of fld "Today" to "16,58"

if the cShowButtons of me = false then exit resizeStack

set the loc of btn "Previous Day" to "76," & newH - 38

set the loc of btn "Previous Month" to "76," & newH - 4

set the loc of btn "Today" to (newW div 2 & comma & newH - 38)

set the loc of btn "This month" to (newW div 2 & comma & newH - 4)

set the loc of btn "Next Day" to (newW - 76 & comma & newH - 38)

set the loc of btn "Next Month" to (newW -76 & comma & newH - 4)

end resizeStack

on toggleButtonDisplay

lock screen

if the cShowButtons of me = true then

show grp "Buttons"

put "Hide buttons/B" into line 9 of btn "File"

else

hide grp "Buttons"

put "Show buttons/B" into line 9 of btn "File"

end if

resizeStack the width of this stack, the height of this stack

if the cShowButtons of me = true then

unlock screen with visual effect wipe up very fast

else

unlock screen with visual effect wipe down very fast

end if

end toggleButtonDisplay

on clearAll

put empty into fld "ShownDate"

put empty into fld "Today"

end clearAll

 @cREVGeometryCacheIDs 107413411229510031074134185521101310741341334701009107413413346910081074134133471101010742045897281018107413412686010051074134126861100610742055482521014107413412686210071074205548253101510742055482541017cREVGeometrycachetotal12orderp 1074134112295 1074134185521 1074134126861 1074134126862 1074134133470 1074134133471 1074134126860 1074134133469 Today `:yP cREVGeometryMaster,scaleBottomObjectSideBottomMaster,movehDistancefalseMaster,scaleBottomscaleBottomtrueMaster,scaleRightscaleBottomtrueMastertrueMaster,scaleTopObjectRefcardMaster,scaleLeftObjectRefcardMaster,scaleBottomObjectRefcardMaster,scaleBottomAbsolutefalseMaster,scaleBottomfalseMaster,scaleTopObjectSideTopMaster,scaleLeftObjectSideLeftMaster,expectedRect 16,34,484,216Master,scalebottomDistance-0.28Master,movevDistancefalseMaster,scaleRightAbsolutefalseMaster,scaleRightfalseMaster,scalerightDistance-0.032Master,scaleTopAbsolutetrueMaster,scaleLeftAbsolutetrueMaster,scaleRightObjectSideRightMaster,scaleRightObjectRefcardMaster,scaleTopfalseMaster,scaleLeftfalseMaster,cardRanking0Master,scaleleftDistance16Master,scaletopDistance34 cREVGeneral revUniqueID 1074134112295  `;ha  ShownDate  cREVGeometryMaster,movehDistancefalseMaster,scaleRightscaleBottomtrueMastertrueMaster,scaleLeftObjectRefcardMaster,scaleLeftObjectSideLeftMaster,movevDistancefalseMaster,scalebottomDistanceMaster,expectedRect 16,8,484,29Master,scaleRightAbsolutefalseMaster,scaleRightfalseMaster,scalerightDistance-0.032Master,scaleRightObjectRefcardMaster,scaleRightObjectSideRightMaster,scaleLeftAbsolutetrueMaster,scaleLeftfalseMaster,cardRanking0Master,scaletopDistanceMaster,scaleleftDistance16 cREVGeneral revUniqueID 1074134185521 bookmarks handlerList tempScript prevHandlerscriptSelectionchar 205 to 204script  ucMenubarIon mouseDown if the cShowButtons of this stack = true then put "Hide buttons/B" into line 9 of btn "File" else put "Show buttons/B" into line 9 of btn "File" end if end mouseDown N cREVGeneralscriptChecksumڃ!X bookmarks revUniqueID 1074205548251 handlerList mouseDownscriptSelectionchar 193 to 192 prevHandler mouseDown tempScriptscript

on mouseDown

if the cShowButtons of this stack = true then

put "Hide buttons/B" into line 9 of btn "File"

else

put "Show buttons/B" into line 9 of btn "File"

end if

end mouseDown

FileŋU--The following menuPick handler was generated by the Menu Builder. on menuPick pWhich switch pWhich case "Today" case "Previous day" case "Next day" case "This month" case "Previous month" case "Next month" send mouseUp to btn pWhich break case "Hide buttons" set the cShowButtons of this stack to false toggleButtonDisplay break case "Show buttons" set the cShowButtons of this stack to true toggleButtonDisplay break case "Quit" quit break end switch end menuPick  kToday/T Previous day/R Next day/Y - This month/M Previous month/N Next month/, - Show buttons/B (- &Quit/Q cREVGeneralscriptChecksum0;O3o?Gm bookmarks revUniqueID 1074205548252 handlerListmenuPickscriptSelectionchar 531 to 530 prevHandlermenuPick tempScriptscript

--The following menuPick handler was generated by the Menu Builder.

on menuPick pWhich

switch pWhich

case "Today"

case "Previous day"

case "Next day"

case "This month"

case "Previous month"

case "Next month"

send mouseUp to btn pWhich

break

case "Hide buttons"

set the cShowButtons of this stack to false

toggleButtonDisplay

break

case "Show buttons"

set the cShowButtons of this stack to true

toggleButtonDisplay

break

case "Quit"

quit

break

end switch

end menuPick

HelpŋU--The following menuPick handler was generated by the Menu Builder. on menuPick pWhich switch pWhich case "Help" answer information "You don't need any help." & cr & \ "Just read the text and click the buttons :-)" & cr & cr & \ "The shortcuts are arranged so " & numToChar(17) & "T is today" & cr & \ "and " & numToChar(17) & "M is this month with the keys on either" & cr & \ "side moving forwards or backwards." \ as sheet break case "About UnixCal..." answer information "This application takes data from" & cr & \ "the FreeBSD calendar utility." & cr & cr & \ "The raw data is in /usr/share/calendars/" & cr & \ "but you will need to juggle with" & cr & \ "privileges if you want to edit it." & cr & cr & \ "Sarah Reichelt " & cr & "January 2004" as sheet break end switch end menuPick !&&Help - &About UnixCal... cREVGeneralscriptChecksum=&Sc]MC% bookmarks revUniqueID 1074205548253 handlerListmenuPickscriptSelectionchar 484 to 483 prevHandlermenuPick tempScriptscript

--The following menuPick handler was generated by the Menu Builder.

on menuPick pWhich

switch pWhich

case "Help"

answer information "You don't need any help." & cr & \

"Just read the text and click the buttons :-)" & cr & cr & \

"The shortcuts are arranged so " & numToChar(17) & "T is today" & cr & \

"and " & numToChar(17) & "M is this month with the keys on either" & cr & \

"side moving forwards or backwards." \

as sheet

break

case "About UnixCal..."

answer information "This application takes data from" & cr & \

"the FreeBSD calendar utility." & cr & cr & \

"The raw data is in /usr/share/calendars/" & cr & \

"but you will need to juggle with" & cr & \

"privileges if you want to edit it." & cr & cr & \

"Sarah Reichelt <sarah@troz.net>" & cr & "January 2004" as sheet

break

end switch

end menuPick

Buttonsa ^xA cREVGeneral revUniqueID 1074204589728TodayEon mouseUp put the short English date into tDate put filterDate(tDate, false) into fld "Today" showDisplayedDate tDate, false end mouseUp bx cREVGeometryMaster,moveVObjectSidebottomMaster,movehDistance-0.468MastertrueMaster,moveVObjectRefcardMaster,movehObjectRef 1074134126862Master,moveVAbsolutefalse Master,moveVfalseMaster,movevDistance -0.206667Master,scalebottomDistanceMaster,expectedRect130,232,250,255Master,movehObjectSiderightMaster,scalerightDistanceMaster,cardRanking0Master,movehAbsolutefalseMaster,scaletopDistanceMaster,scaleleftDistance Master,movehfalse cREVGeneralscriptChecksum% s? R bookmarks revUniqueID 1074134126860 handlerListmouseUpscriptSelectionchar 147 to 146 prevHandlermouseUp tempScriptscriptt

on mouseUp

put the short English date into tDate

put filterDate(tDate, false) into fld "Today"

showDisplayedDate tDate, false

end mouseUp

 Previous dayEon mouseUp put getDisplayedDate() into tDate subtract 1 from item 3 of tDate convert tDate to short English date put filterDate(tDate, false) into fld "Today" showDisplayedDate tDate, false end mouseUp bx cREVGeometryMaster,scaleBottomObjectSideBottomMaster,moveVObjectSidebottomMaster,movehDistancefalseMaster,scaleBottomscaleBottomtrueMastertrueMaster,moveVObjectRefcardMaster,scaleBottomObjectRefcardMaster,scaleBottomAbsolutefalseMaster,moveVAbsolutefalseMaster,scaleBottomfalse Master,moveVfalseMaster,expectedRect12,232,132,255Master,scalebottomDistance -0.166667Master,movevDistance -0.206667Master,scalerightDistanceMaster,cardRanking0Master,scaleleftDistanceMaster,scaletopDistance cREVGeneralscriptChecksumWrcDY  bookmarks revUniqueID 1074134126861 handlerListmouseUpscriptSelectionchar 204 to 203 prevHandlermouseUp tempScriptscript

on mouseUp

put getDisplayedDate() into tDate

subtract 1 from item 3 of tDate

convert tDate to short English date

put filterDate(tDate, false) into fld "Today"

showDisplayedDate tDate, false

end mouseUp

 Next dayEon mouseUp put getDisplayedDate() into tDate add 1 to item 3 of tDate convert tDate to short English date put filterDate(tDate, false) into fld "Today" showDisplayedDate tDate, false end mouseUp bx cREVGeometryMaster,moveVObjectSidebottomMaster,scaleBottomObjectSideBottomMaster,scaleBottomscaleBottomtrueMaster,movehDistance-0.152Master,scaleRightscaleBottomtrueMastertrueMaster,moveVObjectRefcardMaster,scaleBottomObjectRefcardMaster,moveHObjectRefcardMaster,moveVAbsolutefalseMaster,scaleBottomAbsolutefalse Master,moveVfalseMaster,scaleBottomfalseMaster,expectedRect370,232,490,255Master,scalebottomDistance -0.166667Master,movevDistance -0.206667Master,moveHObjectSiderightMaster,scaleRightAbsolutefalseMaster,scaleRightfalseMaster,scalerightDistance-0.032Master,scaleRightObjectSideRightMaster,scaleRightObjectRefcardMaster,cardRanking0Master,moveHAbsolutefalseMaster,scaleleftDistanceMaster,scaletopDistance Master,moveHfalse cREVGeneralscriptChecksumq -dNMK^| revUniqueID 1074134126862 bookmarks handlerListmouseUp tempScript prevHandlermouseUpscriptSelectionchar 197 to 196script

on mouseUp

put getDisplayedDate() into tDate

add 1 to item 3 of tDate

convert tDate to short English date

put filterDate(tDate, false) into fld "Today"

showDisplayedDate tDate, false

end mouseUp

 This monthEon mouseUp put the short English date into tDate put filterDate(tDate, true) into fld "Today" showDisplayedDate tDate, true end mouseUp x cREVGeometryMaster,moveVObjectSidebottomMaster,movehDistance-0.468MastertrueMaster,moveVObjectRefcardMaster,movehObjectRef 1074134133471Master,moveVAbsolutefalse Master,moveVfalseMaster,movevDistance -0.093333Master,scalebottomDistanceMaster,expectedRect130,270,250,293Master,movehObjectSiderightMaster,scalerightDistanceMaster,cardRanking0Master,movehAbsolutefalseMaster,scaletopDistanceMaster,scaleleftDistance Master,movehfalse cREVGeneralscriptChecksumos^0& revUniqueID 1074134133469 bookmarks handlerListmouseUp tempScript prevHandlermouseUpscriptSelectionchar 145 to 144scriptr

on mouseUp

put the short English date into tDate

put filterDate(tDate, true) into fld "Today"

showDisplayedDate tDate, true

end mouseUp

Previous monthEon mouseUp put getDisplayedDate() into tDate subtract 1 from item 2 of tDate convert tDate to short English date put filterDate(tDate, true) into fld "Today" showDisplayedDate tDate, true end mouseUp x cREVGeometry Master,movevDistance -0.093333Master,scalebottomDistanceMaster,expectedRect12,270,132,293Master,moveVObjectSidebottomMaster,movehDistancefalseMastertrueMaster,moveVObjectRefcardMaster,scalerightDistanceMaster,cardRanking0Master,moveVAbsolutefalse Master,moveVfalseMaster,scaletopDistanceMaster,scaleleftDistance cREVGeneralscriptChecksum:31/j?Mzgw revUniqueID 1074134133470 bookmarks handlerListmouseUp tempScript prevHandlermouseUpscriptSelectionchar 202 to 201script

on mouseUp

put getDisplayedDate() into tDate

subtract 1 from item 2 of tDate

convert tDate to short English date

put filterDate(tDate, true) into fld "Today"

showDisplayedDate tDate, true

end mouseUp

 Next monthEon mouseUp put getDisplayedDate() into tDate add 1 to item 2 of tDate convert tDate to short English date put filterDate(tDate, true) into fld "Today" showDisplayedDate tDate, true end mouseUp x cREVGeometryMaster,moveVObjectSidebottomMaster,scaleBottomObjectSideBottomMaster,movehDistance-0.152Master,scaleBottomscaleBottomtrueMaster,scaleRightscaleBottomtrueMastertrueMaster,moveVObjectRefcardMaster,scaleBottomObjectRefcardMaster,moveHObjectRefcardMaster,moveVAbsolutefalseMaster,scaleBottomAbsolutefalse Master,moveVfalseMaster,scaleBottomfalseMaster,expectedRect370,261,490,284Master,scalebottomDistance -0.053333Master,movevDistance -0.093333Master,moveHObjectSiderightMaster,scaleRightAbsolutefalseMaster,scaleRightfalseMaster,scalerightDistance-0.032Master,scaleRightObjectSideRightMaster,scaleRightObjectRefcardMaster,cardRanking0Master,moveHAbsolutefalseMaster,scaleleftDistanceMaster,scaletopDistance Master,moveHfalse cREVGeneralscriptChecksum~ on mouseUp

put getDisplayedDate() into tDate

add 1 to item 2 of tDate

convert tDate to short English date

put filterDate(tDate, true) into fld "Today"

showDisplayedDate tDate, true

end mouseUp