home *** CD-ROM | disk | FTP | other *** search
- /* phyzmemo.rexx */
-
- arg host
-
-
- /* Define default values of parameters */
- date = "Automatic"
- to = "John Doe"
- from = "Jane Doe"
- topic.1 = "Axiomatic love theory"
- topic.2 = ""
- topic.3 = ''
- topic.4 = ''
- topic.5 = ''
- topic.6 = ''
- topic.7 = ''
- copies = "no"
- filename = "vd0:memo.tex"
-
- /* set up gadgets */
-
- text = "\\"||copies(' ',51)||"Date:\\\\ To:\\ From:\\ Topic:\\\\\\\\\\\\\"
- text =text||"\\\ To change an entry fill in the desired text\"
- text =text||" in the available space and then hit RETURN \"
- text =text||" When you are finished CLICK on the CONTINUE gadget\\\"
- text =text||"\\ Copies:\\ Filename:\\"
-
- call MenuWindow(MYHOST,MEMOPORT)
-
- call WindowText(MYHOST,text)
-
- call AddGadget(MYHOST,480,37,"DATE",date,"%d%1%g",180)
- call AddGadget(MYHOST,120,69,"TO",to,"%d%1%g",280)
- call AddGadget(MYHOST,120,88,"FROM",from,"%d%1%g",280)
- call AddGadget(MYHOST,120,107,"TOPIC1",topic.1,"%d%1%g",400)
- call AddGadget(MYHOST,120,126,"TOPIC2",topic.2,"%d%1%g",400)
- call AddGadget(MYHOST,120,145,"TOPIC3",topic.3,"%d%1%g",400)
- call AddGadget(MYHOST,120,164,"TOPIC4",topic.4,"%d%1%g",400)
- call AddGadget(MYHOST,120,183,"TOPIC5",topic.5,"%d%1%g",400)
- call AddGadget(MYHOST,120,202,"TOPIC6",topic.6,"%d%1%g",400)
- call AddGadget(MYHOST,120,221,"TOPIC7",topic.7,"%d%1%g",400)
-
- call AddGadget(MYHOST,120,315,"COPIES",copies,"%d%1%g",180)
- call AddGadget(MYHOST,120,334,"FILENAME",filename,"%d%1%g",260)
-
- call AddGadget(MYHOST,480,338,"CONTINUE","\ CONTINUE \","%d%1%d")
-
- quitflag = 0
-
- do forever
- if quitflag = 1 then leave
- t = waitpkt(MEMOPORT)
- do ff = 1
- p = getpkt(MEMOPORT)
- if c2d(p) = 0 then leave ff
-
- arg = getarg(p)
- t = reply(p, 0)
- parse var arg command string
- select
- when command = CLOSEWINDOW then do
- call CloseWindow(MYHOST)
- quitflag = 1
- end
- when command = "CONTINUE" then do
- quitflag = 1
- call WriteTexFile(filename)
- call CloseWindow(MYHOST)
- end
- when command = "DATE" then call ActivateGadget(myhost,"TO")
- when command = "TO" then call ActivateGadget(myhost,"FROM")
- when command = "FROM" then call ActivateGadget(myhost,"TOPIC1")
- when command = "TOPIC1" then call ActivateGadget(myhost,"TOPIC2")
- when command = "TOPIC2" then call ActivateGadget(myhost,"TOPIC3")
- when command = "TOPIC3" then call ActivateGadget(myhost,"TOPIC4")
- when command = "TOPIC4" then call ActivateGadget(myhost,"TOPIC5")
- when command = "TOPIC5" then call ActivateGadget(myhost,"TOPIC6")
- when command = "TOPIC6" then call ActivateGadget(myhost,"TOPIC7")
- when command = "TOPIC7" then call ActivateGadget(myhost,"COPIES")
- when command = "COPIES" then call ActivateGadget(myhost,"FILENAME")
- when command = "FILENAME" then call ActivateGadget(myhost,"DATE")
- otherwise say command
- end
- end /* ends ff */
- end /* ends do forever */
- if host = "WB" then queue endcli
- exit
-
- /* MenuWindow.rexx - menu making function */
-
- MenuWindow:
-
- arg menuhost, menuport
- runwsh "'x=createhost("menuhost||","||menuport||")'"
- mp = openport(menuport)
-
- do i = 1 to 2
- address command 'c:WaitForPort 'menuport
- if RC=0 then leave i
- end
-
- idcmp = 'CLOSEWINDOW+GADGETUP'
- flags = 'WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH+BACKFILL'
-
- call OpenWindow(menuhost, 0, 0,screencols(),screenrows(), idcmp, flags)
-
- call setapen(menuhost,2)
- call setbpen(menuhost,1)
- call setdrmd(menuhost,JAM2)
-
- return 0
-
- /* GetVar.rexx */
-
- GetVar:
- parse arg menuhost, menuport, gadgetname
- call ReadGadget(menuhost,gadgetname)
- t = waitpkt(menuport)
- p = getpkt(menuport)
- string = getarg(p,1)
- t = reply(p,0)
- string = strip(string)
- return string
-
-
- WriteTexFile:
- arg filename
-
- date = GetVar(MYHOST,MEMOPORT,"DATE")
- to = GetVar(MYHOST,MEMOPORT,"TO")
- from = GetVar(MYHOST,MEMOPORT,"FROM")
- topic.1 = GetVar(MYHOST,MEMOPORT,"TOPIC1")
- topic.2 = GetVar(MYHOST,MEMOPORT,"TOPIC2")
- topic.3 = GetVar(MYHOST,MEMOPORT,"TOPIC3")
- topic.4 = GetVar(MYHOST,MEMOPORT,"TOPIC4")
- topic.5 = GetVar(MYHOST,MEMOPORT,"TOPIC5")
- topic.6 = GetVar(MYHOST,MEMOPORT,"TOPIC6")
- topic.7 = GetVar(MYHOST,MEMOPORT,"TOPIC7")
- copies = GetVar(MYHOST,MEMOPORT,"COPIES")
- filename = GetVar(MYHOST,MEMOPORT,"FILENAME")
-
- /* check to see if the file already exists */
-
- do outer = 1
- if ~exists(filename) then leave outer
- else do
- string = "FILE" filename "ALREADY EXISTS.\"
- string = string||"TO REPLACE CLICK ON REP\"
- string = string||"HIT QUIT IF YOU WANT OUT OF THIS EXEC"
- ans = request(200,200,string,,"REP","QUIT",)
- end
-
- select
- when ans = "OKAY" then leave outer
- when ans = "" then do
- "set phyzmemoinfo="
- return(3)
- end
- end
- end
-
-
- /* Erase previous file with this name */
-
- if exists(filename) then "delete "filename
-
- /* Now write the TeX file */
-
- checkfile = open(outfile, filename, 'W')
- if checkfile = 0 then do
- say "Couldn't open file for output"
- exit
- end
-
- call writeln outfile, '%macropackage=phyzzx'
-
- /* Following line is unique to new PHYZZX */
-
- if date ~= 'Automatic' then call writeln outfile, '\date={'date'}'
- call writeln outfile, '\memo'
- call writeln outfile, '\to' to
- call writeln outfile, '\from' from
- call writeln outfile, '\topic' topic.1
- if topic.2 ~= '' then call writeln outfile, topic.2
- if topic.3 ~= '' then call writeln outfile, topic.3
- if topic.4 ~= '' then call writeln outfile, topic.4
- if topic.5 ~= '' then call writeln outfile, topic.5
- if topic.6 ~= '' then call writeln outfile, topic.6
- if topic.7 ~= '' then call writeln outfile, topic.7
- call writeln outfile, ' '
- call writeln outfile, '\rule '
- call writeln outfile, ' '
- call writeln outfile, '%memobody%'
- call writeln outfile, ' '
- call writeln outfile, ' '
-
-
- /* Check if there are to be copies */
-
- if copies ~= 'no' then do
- call writeln outfile, ' '
- call writeln outfile, '\copies %This is to be
- followed by the list of people to whom you wish '
- call writeln outfile, '% copies to be sent. To get
- one name to a line type NAME \nextline'
- call writeln outfile, ' '
- call writeln outfile, ' '
- call writeln outfile, ' '
- call writeln outfile, ' '
- end
-
- call writeln outfile, '\endpage'
- call writeln outfile, '\end'
- call close(outfile)
-
-
- /* Now XEDIT the file */
-
- "e "filename
- "set phyzmemoinfo="
- call delay 150
-
-