home *** CD-ROM | disk | FTP | other *** search
- /* filename: PrintEnvelope */
- /* version: 1.2 23 Oct 95 */
- /* */
- /* purpose: FinalWriter macro to print a return and recipient address on a */
- /* single-fed envelope on an HP540 (or other HP printers which */
- /* support single-fed #10 envelopes). This would most often be */
- /* used from within a document being created which will be */
- /* mailed to someone, using a business format where their */
- /* address is part of the document. */
- /* */
- /* syntax: called from within FinalWriter */
- /* */
- /* author: Jim Dutton */
- /* jimd@slip106.termserv.siu.edu */
- /* ca0008@siucvmb.siu.edu */
- /* */
- /* prereqs: ENV:FW/MyName, ENV:FW/MyAddress, ENV:FW/MyCityStateZip */
- /* */
- /* usage: set the prerequisite Environment variables with your desired */
- /* return address (your return address can be one or two lines) */
- /* */
- /* create FW document WITH recipient address as part of the text, */
- /* in the format of a mailing address (ie; seperate lines) */
- /* */
- /* highlight the recipient address text and invoke this macro */
- /* */
- /* comments: the UNIVERS font is preselected - the envelope print setup is */
- /* predetermined by the printer - only use envelopes that your */
- /* printer supports - the "EXTRACT" comment obtains the recipient */
- /* address data from FinalWriter */
-
- Options Results
-
- If ~open(hp540,'PAR:') then
- Do; say '** Unable to open PARallel port **'; Exit 32; End
-
- If ~open(envname,"ENV:FW/MyName") then
- Do; say '** Unable to open ENV:FW/MyName **'; Exit 33; End
- myname = strip(readln(envname)); duh = close(envname)
-
- If ~open(envaddr,"ENV:FW/MyAddress") then
- Do; say '** Unable to open ENV:FW/MyAddress **'; Exit 34; End
- myaddress.1 = strip(readln(envaddr))
- If ~eof(envaddr) then myaddress.2 = strip(readln(envaddr))
- Else myaddress.2 = ""
- duh = close(envaddr)
-
- If ~open(envstate,"ENV:FW/MyCityStateZip") then
- Do; say '** Unable to open ENV:FW/MyCityStateZip **'; Exit 35; End
- myCityStateZip = strip(readln(envstate)); duh = close(envstate)
-
- esc = '1B'x; reset = esc || "E"; line_termination = esc || "&k3G"
- univers = esc || "(s1p12v0s0b52T"
- paper_size.envelope = esc || "&l81A"
- EnvelopeFeed = esc || "&l3H"
- LeftMargin50_Skip8Rows = esc || "&a50l&a+8R"
-
- duh = writeln(hp540,reset)
- duh = writeln(hp540,line_termination)
- duh = writech(hp540,univers)
- duh = writech(hp540,paper_size.envelope)
- duh = writeln(hp540,EnvelopeFeed)
-
- duh = writeln(hp540,myname); duh = writeln(hp540,myaddress.1)
- If myaddress.2 ~= "" then duh = writeln(hp540,myaddress.2)
- duh = writeln(hp540,myCityStateZip)
-
- duh = writeln(hp540,LeftMargin50_Skip8Rows)
-
- "Extract"; duh = writech(hp540,Result)
-
- duh = writeln(hp540,reset); duh = close(hp540)
- Exit
-