MACMERGE\MACMERGE  ·  TXT  ·  2.7 KB  ·  1991-12-01  ·  from PCPlus_Issue-63_Dec-1991_FluxEngine-360Kb
>>> MACMERGE 30 September 1991 J.S. Blackburn
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>iu DOCFILE ; we haven't defined DOCFILE yet, so this part..
>>> ...of the code will run on the first pass only.
>cs " " ; clear the screen
>dm "┌──────────────────────────────────────────────────────┐
>dm "│        MACMERGE V 1.0 - MACRO MERGE UTILITY          │
>dm "│ Merges names and addresses into a Document or Letter │
>dm "│ which is stored as a Macro in the Laserjet.          │
>dm "└──────────────────────────────────────────────────────┘
>dm "                                           ESC to quit."
>dm " "
>av "Document to print (RETURN for Example.LET): " docfile 12
>if docfile=""
>sv docfile="Example.LET" ; default for DEMO
>ei ; docfile
>dm &docfile&
>dm " "
>av "Address File (RETURN for Example.ADD)? " addfile 12
>if addfile=""
>sv addfile="EXAMPLE.ADD" ; default for DEMO
>ei
>>>
>dm "Sending &docfile& as a Macro to the Printer..."
>>> the following 5 lines go to the printer
>oc 27,"&f123Y"	; define Macro Number 123
>oc 27,"&f0X"	; Start of Macro definition
>in &docfile&	; INSERT the Macro text (the complete letter)
>oc 27,"&f1X"	; end of Macro definition
>oc 27,"&f10X"	; make Macro permanent (not erased by RESET)
>dm "&docfile& now sent. Merging..."
>>>
>dm " "
>df &ADDFILE& ; open the Address File for READ
>sv Pass=-1 ; count records.
>ei ; end of "iu ADDFILE" - initialisation complete
>>>>>>>> CODE ABOVE THIS LINE ONLY RUNS ONCE >>>>>>>>>>>>
>>> Program loops back to here until ADDFILE is exhausted
>sv Pass=Pass+1 Pass=Pass[W1]
>sk Pass=0 ; if Pass=0, skip straight back to the top
>>> Laserjet RESET code sent here, cursor is at Top-of-Page
>oc 27,"&f0S" ; push (save) top-of-page cursor
>>>MAILMERGE CODE GOES BELOW; DON'T CHANGE LINES ABOVE >>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>> Read all fields from a Record in ADDFILE
>rv name phone dummy1 dummy2 addr1 addr2 addr3 addr4 dmy4
>tm 3 ; set top margin to same as letter
>sm 10 ; Side margin - move Address to required column
>>> position Address with empty lines, print fields needed









!name!
!addr1!
!addr2!
!addr3!
!addr4!
>sv firstname=name[W1] surname=name[W-1] initial=firstname[1]
>dm "&Pass&. &surname&" ; echo Record No. and surname to screen

⌡Attn. &initial&. &surname&⌡


Dear &firstname&,
>>> END OF YOUR MAILMERGE CODE. DON'T CHANGE THE LINES BELOW >>>
>oc 27,"&f1S" ; pop (restore) cursor
>oc 27,"&f123y3X" ; define and CALL Macro No. 123
>>> the following lines are optional
>ie
>oc 27,"&f123Y" ; define Macro No. 123
>oc 27,"&f9X" ; make it temporary
>oc 27,"&f8X" ; delete the Macro, release the memory
>oc 12 ; eject the last letter
>st "Macro Mailmerge complete."
>ei