Mail merge--again

J. Landman Gay jacque at hyperactivesw.com
Sat Sep 20 22:02:36 EDT 2008


James Hurley wrote:
> This doesn't work:
> 
> on mouseUp
>    repeat with i = 1 to 5
>       put cr & cr & cr & "      " & i  into field 1
>       print this card from 142, 30 to 681,556
>    end repeat
> end mouseUp
> 
> What I would like to do is print the number i, running from 1 to 5 on 
> the fourth line down on the card. (The real objective is mail merge in a 
> letter, but I'm trying to keep it simple here.)
> 
> This handler produces 5 separate pages in Preview--on the Mac. To print  
> the 5 pages I would have to click "Print" on each of the 5 pages in 
> Preview. (I actually have a couple of hundred letters.)
> 
> My objective is to build 5 pages to print in the repeat loop and send 
> them to the printer while go out for coffee.
> 
> How is that done? So far, all I can handle is the coffee part.

Just surround your repeat loop with "open printing" and "close printing" 
commands:

   open printing -- tell the engine to expect a print job
    repeat with i = 1 to 5
       put cr & cr & cr & "      " & i  into field 1
       print this card from 142, 30 to 681,556 -- adds to the print job
    end repeat
   close printing -- sends the whole batch to the printer as one job

This way you only have to click "Print" once, though you'll need to wait 
for the repeat loop to finish before you see a print dialog.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list