The No-frills Mail Merge Program Written using OSS's Personal Pascal. Public Domain software. Portions however are copyright 1985 by OSS and CCD. I call this a no-frills program but it does have some features you may be able to use. Why did I write this program? Well, I had a letter to send out to about 50 addressees and 1st Word didn't do mail merge and ST Writer only does a limited form that was unsuitable for my task. In ST Writer you have to have as many lines marked for the merge text as the max number of lines you will be merging in. Since the addressees on the letter varied from three lines to seven lines, it would have made the letter look awkward with multiple blank lines. I had no desire to spend my money on a word processor program just to get this feature! So a simple version of a mail merge program was written. Features: - Up to 12 different merge 'blocks' may be used. - Each merge 'block' may have multiple lines of text. - Merge 'blocks' may be used in more than one position. - Up to 30 total lines of text may be merged into each text file. - Text lines may be up to 110 characters long. - Program will automatically perform word wrap. - Word wrap may be turned off on a line-by-line basis. - Special 'block' mark characters may be used in the text. Drawback: - Indented text must be marked as 'no word wrap'. - Output only to printer. What is a Mail Merge program for? A merge program will take two text files, normally a master letter and a second text file of addresses, names and other personalized items for a number of people/companies, and combine the two so the output looks personal but really was fast and easy. A good example of where a mail merge program can be handy is when sending out Christmas letters. A common (but perhaps not enjoyable) example is the 'junk' mailings everyone receives that announce "You may have already won..." How to use the program: When typing the main letter to use with the merge program, everywhere you want to insert text from the merge file you need to put a special symbol. What symbols can you use? There are 12 set up now and they are: %, >, <, #, *, [, ], \, /, @, ^ and ~ So if your letter started out with: Dear Joe; and the name was going to be from the merge file, you could use: Dear #; In the merge file you would make an entry then of: #Joe{ What is that { doing in there? Well, as I said the program will do word wrap unless you tell it not to. The { symbol on the end of any line of text in the main or merge text files will stop word wrap for that line. The program will print with word wrap any text it has received before that line, then print the 'no-wrap' line starting on a new line. If you knew you were going to have a blank line after the salutation, then the { would not be necessary. What if you need to use the # in the letter? Say you were going to say you caught a 12# Bass? Well that is permissible, so long as you do not use the # as a control character in the merge file. Blocks: With only 12 symbols the program might seem limited, but another feature can ease the pain. If you were sending out a business letter and had the address in each letter above the salutation you could do it like this: Main text of 1300 Looney Tunes Lane{ Smalltown, USA 11111{ February 7, 1987 ^ Dear %: Merge text of ^Mr. Joe Blow{ ^The XYZ Company{ ^1230 Great Profits Road{ ^Anytown, USA 00000 %Mr. Blow Notice the use of the { (no word wrap) symbol in both the main text and the merge file. It is necessary whenever you want the format to remain as in the file and the following line in the main file is not blank. The nice feature that I call a block is that the same symbol can be used for multiple lines of text in the merge file, creating a block of text to move in but only using one symbol. The multiple lines of text that go in ARE counted against the 30 line limit however. Inter-letter marks: The merge text file must have a way to distinguish one letter's lines of text from the next. To do this the | symbol is used. An example is the easiest way to show this. Merge Text file: ^Mr. Joe Blow{ First letters text ^The XYZ Company{ has an address of 4 lines ^1230 Great Profits Road{ ^Anytown, USA 00000 %Mr. Blow and ends here. | The end of record symbol is the | ^Mr. Big Bucks{ Record 2 has an address of 6 ^The ZYX Company{ lines, but will still have the ^99 Leisure Lane{ same spacing between address and ^P.O. Box 0101{ salutation. ^Grantville Station{ ^Bigtime, USA 00000 %Mr. Bucks | End the last record with the same | symbol and a RETURN Each record may have up to 30 lines. The items in the merge text file may be used in multiple locations within the main text. If the letter to Joe had a line that said "Oh, by the way Joe, I ..." You could use the same symbol and not enter the repeat in the merge text file. An example just to be sure it is clear: Main text file of: Dear ^: Everyone is fine here in Omaha, and we hope @ are fine also in #. Oh, by the way ^, I ... Merge text file: ^Joe @the Smiths #Great Falls | All set up, and no place to go... Ok, so you decided to write a mail-merge letter and now you run the MAILMERG.TOS program. What does it ask for? 1: Top margin. This is how many lines down from where you set-up the paper you want the text to start. Basically it will line feed down that many lines before starting to print the letter. 2: Bottom margin. How many blank lines at the bottom of each page do you want. 3: Left margin. It will 'pad' text with spaces this far over on every line. 4: Right margin. What the maximum column number is you want the text to extend to. 5: Lines/page. Most printers are 66 lines/page. 6: Continuous feed or Single sheets. Enter a C or S. Single sheets will cause the program to pause after each page to allow you to insert a new piece of paper in the printer. 7: Form feed code: This is the decimal code for the form feed control character. In most cases a 12 will work ($0C). 8: Main file: Enter the complete file name, including path. Ex., A:\MAINLTR.TXT 9: Merge file: The text file that contains the merge data lines. Again, enter the complete path name. Note: In all cases you must enter a value. A bare will probably bomb the program. And that's it. I hope the program works well for you. It was done, as I said, rather hastily and there may be some bugs in it. If you find a problem or have a suggestion send me a message and I'll try and get it fixed right away. (But I am working on another major project that has already grown to a source code of over 4500 lines...) David Chiquelin GEnie - D.CHIQUELIN CIS - 71336,1443 Delphi - DCHIQUELIN Atari-O! (402) 592-4435 - Sysop