Mail merge in Run Rev

Peter Brigham pmbrig at gmail.com
Mon Sep 15 17:52:39 EDT 2008


On Sun, 14 Sep 2008 07:21:55, James Hurley  
<jhurley0305 at sbcglobal.net> wrote:

> This is a new area for me, but I'm sure it is a common task for many
> of you.
>
> I have a mail merge job for a local election.
>
> I have generated all the data in RR for the letter, i.e. the label
> and the greeting for the letter from the election data base. (This
> greeting is a little complicated and that's where RR comes in. It is
> necessary to construct a greeting for the household, a household
> which may contain several people and some with different last names.
> Anyway Rev is  good at that part.)
>
> Is there a convenient way to do the merging of this data with the
> letter  in RR or should I just export the data to File Maker and
> construct the letter there?
>
> In RR would  you store the data and the text of the letter in
> variables, putting them together to construct the text for the field
> and then revprintfield in a repeat loop, one loop for each letter? Is
> this very slow? I have a lot of letters to do.
>
> And how can one deal with the formatting, for example center the
> addressee's name and address at the top of the field, RR allows only
> alignment for the entire field?
>
> Thanks,
>
> Jim Hurley

What I do is the following:

Create a substack "printLetter" with a header field ("pHdr") at the  
top of the card window and a text field ("pText") below it. Set the  
textAlign of the header field to center and the textAlign of the text  
field to left. Put your boilerplate text in a custom property of the  
text field, complete with dummy placeholders like <salutation>,  
<greeting>, etc. For printing, open the printletter stack invisibly,  
put the boilerplate text into the field from the customProp, replace  
"<salutation>" with your script-generated salutation in fld "pText",  
replace "<greeting>" in fld "pText" with your custom greeting for  
that household, etc., ie, customize the text wherever you need by  
using the replace command on established placeholders. Then print the  
card. Most of your time setting this up will be getting the geography  
right so it prints the right size and place on the paper -- look at  
the "print card [from topLeft to rightBottom] [into pageRect]"  
command. Make sure your fields have no visible borders and the  
fillcolor in your printLetter stack is white. You can even get fancy  
and have a logo or other image at the top with your header.

If you have more than one page per letter, it's a little more  
complex. You basically have to roll your own here (presuming you want  
to have pages >=2 have no header), but it's not all that hard. You  
hide the header field for pages >=2 and adjust the height of the text  
field, then scroll repeatedly (there's another way, too). Note that a  
field without scrollbars still scrolls if you script it to do so.

Re speed -- whatever you do in rev will be much faster that your  
printer can handle.

hope this helps,
-- Peter

Peter M. Brigham
pmbrig at gmail.com



More information about the use-livecode mailing list