home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
calmacro.zip
/
Calendar.dml
(
.txt
)
next >
Wrap
DeScribe Document
|
2000-01-28
|
21KB
|
155 lines
DeScribe Copyright DeScribe, Inc., 1988, 1989
Info 1
Info 2
Info 3
Info 4
Macro
Courier
! This macro prompts the user for a month and a year,
! calls up the Calendar Layout and fills in the headings
! with appropriate values. This modification should work
! for years 1950 through 2049.
VAR month
VAR day
VAR year
VAR noDays
VAR daySeq
VAR mo
VAR count
PROCEDURE DaysInMonth
! arguments are m and y, returns d
SET d TO 31
IF m=1 THEN SET mo TO "JANUARY" RETURN END IF
IF m=3 THEN SET mo TO "MARCH" RETURN END IF
IF m=5 THEN SET mo TO "MAY" RETURN END IF
IF m=7 THEN SET mo TO "JULY" RETURN END IF
IF m=8 THEN SET mo TO "AUGUST" RETURN END IF
IF m=10 THEN SET mo TO "OCTOBER" RETURN END IF
IF m=12 THEN SET mo TO "DECEMBER" RETURN END IF
SET d TO 30
IF m=4 THEN SET mo TO "APRIL" RETURN END IF
IF m=6 THEN SET mo TO "JUNE" RETURN END IF
IF m=9 THEN SET mo TO "SEPTEMBER" RETURN END IF
IF m=11 THEN SET mo TO "NOVEMBER" RETURN END IF
SET mo TO "FEBRUARY"
SET z TO year MOD 4
IF z = 0 THEN
SET d to 29
ELSE
SET d TO 28
END IF
END PROCEDURE
PROCEDURE CheckMon
! Call with: month=month
! year=year
! Exits with: noDays=no. of days in month
! monthName=text of month name
! daySeq=first day (0=Sun, 1=Mon, ..., 6=Sat)
SET count TO year * 365
SET q TO year - 1
SET q TO q / 4
SET count TO count + q
SET m TO 1
SET y TO year
REPEAT
EXIT WHEN m = month
CALL DaysInMonth
SET count TO count + d
SET m TO m + 1
END REPEAT
IF year = 00 THEN
SET x TO count+6
SET z TO x MOD 7
SET daySeq TO z
SET m TO month
CALL DaysInMonth
SET noDays TO d
RETURN END IF
IF year >= 50 THEN
SET x TO count+1
SET z TO x MOD 7
SET daySeq TO z
SET m TO month
CALL DaysInMonth
SET noDays TO d
ELSE
SET x TO count
SET z TO x MOD 7
SET daySeq TO z
SET m TO month
CALL DaysInMonth
SET noDays TO d
END IF
END PROCEDURE
MACRO Calendar1
SET MacroDialogTitle to
Set up Calendar
MSET "Month (1-12)" TOVALUE month
MSET "Year (94, for example)" TOVALUE year
MGET
To create a Calendar table in a new DeScribe document, type the desired month and year.
IF month < 1 THEN QUIT END IF
IF month > 12 THEN QUIT END IF
!year should be 0 through 99
IF year < 0 THEN QUIT END IF
IF year > 99 THEN QUIT END IF
CALL CheckMon
NewDocumentFile "CALENDAR.dwp"
SET SelectedFrame TO
CursorHome
PUT mo
PUT " "
KeyTab
IF year >= 50 THEN PUT 1900 + year END IF
IF year < 50 THEN PUT 2000 + year END IF
CursorEndLine
CursorEndLine
CursorEndLine
CursorEndLine
CursorEndLine
CursorEndLine
CursorEndLine
TableCellRight
REPEAT
EXIT WHEN daySeq = 0
TableCellRight
SET daySeq TO daySeq - 1
END REPEAT
SET d TO 1
REPEAT
PUT d
EXIT WHEN d = noDays
SET d TO d + 1
TableCellRight
END REPEAT
TableModifyStart
SET TableTabCreateRows TO FALSE
TableProcessChanges
CursorHome
SET SelectedFrame TO
DeNote
END MACRO
DeScribe Glossary
Create date
Create time
Document name
File name
Pages
Pages (Alphabetic lower case)
Pages (Alphabetic upper case)
Pages (Roman lower case)
Pages (Roman upper case)
Print date
Print time
Revisions
Save date
Save time
August 4, 1994
12:31 P.M.
Calendar4.dml
G:\DeScribe\Macros\Calendar4.dml
January 28, 2000
9:37 P.M.
January 28, 2000
9:38 P.M.