/* ProPage Genie to layout and draw a 3 month table containing columns for each Wednesday for the period. The user must select the starting month/year when presented with a requester. by: Brian Savage 185 des Merisiers Levis, Quebec, Canada G6V 8V7 tel 418-837-6916 GEnie: B.Savage INTERNET: B.Savage@genie.geis.com Requires WB_Calendar to be running (Arexx port name "CALRX") or WB_Calendar in your sys:utilities drawer. Creates a new page using the Default page, so depending on your setup, you may have to make a few changes to this script. */ m.1='January' m.2='February' m.3='March' m.4='April' m.5='May' m.6='June' m.7='July' m.8='August' m.9='September' m.10='October' m.11='November' m.12='December' options results date=GetUserText(5,'Enter a Starting Date (mmmyy)') call New() call AutoUpdate(0) call ShowStatus("Working...") page=CreatePage(1,1,0) call SetPageSize(1,11,8.5) call SetBoxOutLines(0) /* get calendar data */ do j=1 to 3 if j>1 then do do k=1 to 12 if m.k==month then do if k<12 then do nextmonth=k+1 month=m.nextmonth end else do month=m.1 year=year+1 end leave end end k date=substr(month,1,3)||substr(year,3,2) end /* look for WB_Calendar's Arexx port and if it cannot be found, run WB_Calendar from disk and wait for its Arexx port to open */ IF ~SHOW(Ports,'CALRX') THEN DO ADDRESS COMMAND 'run >nil: sys:utilities/wb_calendar x150 y75' DO i=0 TO 3000 WHILE(~SHOW(Ports,'CALRX')) END END IF i==3000 THEN EXIT 20 address CALRX /* get calendar for specified dates from WB_Calendar and parse result string */ getcal date parse var result month year string weekcount=1 cnt=1 do i = 1 to 42 parse var string day.i string cnt=cnt+1 if cnt==8 then do Wed=i-3 if day.Wed~=0 then do monthdays.j.weekcount=day.Wed weekcount=weekcount+1 end cnt=1 end end i monthcolumns.j=weekcount-1 mth.j=month yr.j=year end j totcols= monthcolumns.1+monthcolumns.2+monthcolumns.3 /* draw boxes (grid) */ gridboxwidth=0.45 gridboxhght=0.375 gridleft=4.1 gridtop=1.75 nameboxwidth=2.5 y$boxwidth=gridboxwidth boxid=CreateBox(gridleft,gridtop,gridboxwidth,gridboxhght,0) call SetBoxFrame(boxid,1) call SetBoxMargins(boxid,0,0.1,0,0) topleftbox=boxid boxid_incY=topleftbox do i=1 to 15 do j=2 to totcols boxid=CloneBox(boxid,gridboxwidth,0) end if i<15 then boxid=CloneBox(boxid_incY,0,gridboxhght) boxid_incY=boxid end i /* draw $ boxes */ boxid=CreateBox(gridleft-y$boxwidth,gridtop,y$boxwidth,gridboxhght,0) top_y$box=boxid call SetBoxFrame(boxid,1) do i=1 to 14 boxid=CloneBox(boxid,0,gridboxhght) end call SetFont('(CG)CGTriumvirate') sizeset=SetSize(12) call SetJustification(2) call SetBoxMargins(top_y$box,0,0.1,0,0) success=TextIntoBox(top_y$box,'$YR') /* draw 'name' boxes */ boxid=CreateBox(gridleft-nameboxwidth-y$boxwidth,gridtop,nameboxwidth,gridboxhght,0) top_namebox=boxid call SetBoxFrame(boxid,1) do i=1 to 14 boxid=CloneBox(boxid,0,gridboxhght) end call SetBoxMargins(top_namebox,0,0.1,0,0) success=TextIntoBox(top_namebox,'Name') /* draw dates along first row */ textbox=topleftbox do i =1 to 3 do j=1 to monthcolumns.i success=TextIntoBox(textbox,monthdays.i.j) textbox=textbox+1 end end /* draw dividing lines between months & add month titles */ call SetLineWeight(1) xpos=gridleft linebox=DrawLine(xpos,1.375,xpos,7.375) do i=1 to 3 month_box_pos=xpos+(monthcolumns.i*gridboxwidth/2)-1 xpos=xpos+monthcolumns.i*gridboxwidth linebox=DrawLine(xpos,1.375,xpos,7.375) boxid=CreateBox(month_box_pos,1.475,2.0,0.275,0) success=TextIntoBox(boxid,mth.i) end call ClearStatus /* set print options */ call SetDMLandscape(1) call SetDMPrintMode(0)