7.0

Table Of Contents
18.3 Code Samples
This section presents short samples of PlanetPress Talk code that may be useful, and that may also stimulate
your imagination for the ways in which you can use PlanetPress Talk in your documents. Consult the
PlanetPress Talk Language Reference for help understanding specific commands.
Print a variable number of copies of a page based on a value in the datastream (Page 300)
Store two lines of input data on one line of the data page (Page 300)
Print a line of text on odd-numbered pages (Page 301)
Determine the proper page to print based on the width of the data in the data page (Page 301)
18.3.1 Print a variable number of copies of a page based on a value in the
datastream
This sample prints a variable number of copies of a page based on an integer value in the data stream. It uses
a global integer variable &nbPage that is initialized to 0, and subsequently set to the value of the data that
appears on line 1, columns 1 through 2 of the data page.
The document for which it was written uses two pages: DATA and RUNPAGE. DATA is an overlay page that
contains all of the data selections for the document. RUNPAGE is a runpage and the code that appears here is
in a PlanetPress Talk object on RUNPAGE.
18.3.2 Store two lines of input data on one line of the data page
This sample is a user-defined emulation that reads two lines of input data, concatenates them, and stores
them as a single line in the data page buffer. It terminates a data page when it encounters a form feed
character. The emulation relies on two global variables:
Variable: Type: Initialized
to:
Description:
&second Boolean False The emulation uses this to determine when the current line is a
second line of data. It is True when the current line is a second
line of data.
&line string ““ (the
empty
string)
Holds the contents of a first line of data.
18.3.3 Print a page n-up
This sample prints a page 12-up, in two columns of 6 each. It uses a runpage. The runpage calls an overlay
page, DOCPAGE, that contains the page to print 12-up, and includes data selections defined in a PlanetPress
Talk object. The page to print 12-up does not require scaling; it is created at the size it prints.
The result is a single page with 12 copies of DOCPAGE. Each row contains 2 copies and each copy in a row
displays the same data selection. Data selections change from row to row.
Objectif Lune Inc. © 2009 300