END USER LICENSE AGREEMENT
AND LIMITED WARRANTY
IMPORTANT - READ CAREFULLY
1. LICENSE AGREEMENT AND LIMITED WARRANTY AGREEMENT. - This End User License Agreement (“EULA”) and Limited Warranty (hereinafter collectively the
“License Agreement”) constitute a legal agreement between you (either as a physical, legal person (e.g. corporation) or a partnership) and Objectif Lune Inc.
(“Objectif Lune”) for the software product identified as PlanetPress® Suite, including all companion products, components, patches, updates and upgrades, and also
including any computer software, PostScript® programs, media and all accompanying on-line or printed documentation (collectively the “Software”). The Software
also includes Adobe® Technology and related documentation, and any upgrades, modified versions, additions and copies thereof.
2. BINDING EFFECT. - BY INSTALLING, COPYING, OR OTHERWISE USING THE SOFTWARE, YOU, AS NON-EXCLUSIVE SUB LICENSEE, ACCEPT TO BE AND YOU ARE BOUND BY
ALL OF THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT. IF YOU ARE THE ORIGINAL PURCHASER OF THE SOFTWARE AND DO NOT AGREE WITH THE TERMS
AND CONDITIONS OF THE LICENSE AGREEMENT, PROMPTLY RETURN THE UNUSED SOFTWARE TO THE PLACE FROM WHICH YOU OBTAINED IT FOR A FULL REFUND. BY
YOUR ACCEPTANCE OF THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT AS MENTIONED ABOVE, OBJECTIF LUNE GRANTS YOU THE RIGHT TO USE THE SOFTWARE IN THE MANNER HEREIN PROVIDED.
3. COPYRIGHTS. - This Software is owned by Objectif Lune or its suppliers and is protected by the Copyright Act (Canada), any copyright law and international copyright treaties. Therefore, you must treat this Software like any other copyrighted material (e.g., a book), except that you may, for example, make one copy of the
Software solely a) for backup or archival purposes or b) if it is essential for the compatibility of the computer program, or transfer the Software to a single hard disk,
provided you keep the original solely for backup or archival purposes and that such copy is not installed or used on any other computer.
4. PROPERTY AND INTELLECTUAL PROPERTY RIGHTS. - All Objectif Lune’s libraries, source code, byte code executables and any other files (collectively the “files”)
remain Objectif Lune’s exclusive property. Regardless of any modifications that you make, you may not distribute any files (particularly but not limited to Objectif
Lune source code and other non-executable files) except those that Objectif Lune has expressly designated. Nothing in this License Agreement permits you to derive
the source code of files provided to you in executable form only, or to reproduce, modify, use or distribute the source code of such files. This License Agree ment does
not grant you any intellectual property rights in the Software.
5. TRANSFER. - You may transfer the Software only on a permanent basis, provided you retain no copies except as provided in Section 3 and the recipient or transferee shall be bound by the terms of this License Agreement. Except as provided in this License Agreement, you may not transfer, rent, lease, lend, copy, modify,
adapt, translate, sublicense or time-share in any manner the Software or any part hereof.
6. TRADE SECRET. - You acknowledge that the Software in source code, its structure and organization form remains a confidential valuable trade secret of Objectif
Lune or its suppliers and therefore you agree not to modify the Software or attempt to reverse engineer, decompile or disassemble or otherwise attempt to discover
the source code of the Software.
7. UPGRADED VERSION. - If you have purchased an upgrade version of the Software, this version constitutes a single product with and forms part of the Software.
Any transfer of an upgrade version of the Software can be made only in accordance with this License Agreement.
8. SCOPE OF USE. - You agree to use the Software for your own customary business or personal purposes on only one device (physical or virtual computer system). If
you need to use the Software on more than one device, you must purchase additional licenses. Contact Objectif Lune for applicable royalties payable and licensing
terms. Please refer to th e appropriate following sections 9 o r 10 “ADDITIONAL LICENS E TERMS” for “Variable Content Documents” or - for “Optimized PostScript and
Windows Printing outputs”.
9. ADDITIONAL LICENSE TERMS FOR VARIABLE CONTENT DOCUMENTS. - If the Software can or will generate or create or modify Postscript programs called “Variable
Content Documents” (VCD), any VCD generated by the Software is licensed on a per “licensed output device” basis (including, without limitation, printers, Adobe
Acrobat Distiller, Aladdin Ghostscript, etc.). This means that any VCD generated by the Software can be used by any number of users as long as they use the VCD on
only that single licensed output device. If you need to use the VCD on more than one output device, you must purchase additional licenses. In case of cluster printing
systems (multiple print engines attached to a single Raster Image Processor (RIP), each print engine needs to be licensed individually. Contact Objectif Lune for the
applicable royalties payable and licensing terms for distribution of any VCD.
10. ADDITIONAL LICENSE TE RMS FOR OPTIMIZED POSTSCRIPT AND WINDOWS PRI NTING OUTPUTS.- Section 9 does not apply for PlanetPress Server’s “Optimized Postscript” or “Windows Printing”.
11. TERM. - This license is effective until terminated. Objectif Lune has the right to terminate your license immediately if yo
of this Agreement. Upon ter mination, you must destroy the original and any copy of the Software and cease all use of all the trademarks mentioned herein.
12. LIMITED WARRANTY. - Objectif Lune warrants that the Software media will be free from defects in materials and workmanship, for a period of ninety (90) days
from the date of its purchase.
You must report all errors and return the Software to the location where you bought it with a copy of your receipt within such period to be eligible for warranty service.
u fail to comply with any one of the terms
Objectif Lune’s and its suppliers’ liability and the exclusive remedy shall be, at Objectif Lune’s so le option, either (a) return of the price paid, or (b) repair or replacement of the Software if it does not meet Objectif Lune’s Limited Warranty and if returned to Objectif Lune with a copy of your receipt. No warranty is given by Objectif Lune for and in the name of any of its suppliers.
DO NOT RETURN ANY PRODUCT UNTIL YOU HAVE CALLED THE OBJECTIF LUNE CUSTOMER CARE DEPARTMENT AND PREVIOUSLY OBTAINED A RETURN AUTHORIZATION
NUMBER.
This Limited Warranty is void if failure of the Software results from accident, abuse or misapplication. Any replacement of the Software media will be warranted for
the remainder of the original warranty period or thirty (30) days, whichever is longer. Outside Canada, neither these remedies nor any product support services
offered by Objectif Lune are available without proof of purchase from a duly authorized non-Canadian source.
OBJECTIF LUNE DOES NOT AND CANNOT WARRANT THE PERFORMANCE OR RESULTS YOU MAY OBTAIN BY USING THE SOFTWARE. THIS LICENSE AGREEMENT STATES THE
SOLE AND EXCLUSIVE REMEDIES FOR OBJECTIF LUNE’S BREACH OF WARRANTY, EXPRESS OR IMPLIED, AS TO MERCHANTABILITY, NON-INFRINGEMENT OF THIRD PARTY
RIGHTS, OR FITNESS FOR A PARTICULAR PURPOSE.
For further warranty information, you may contact your nearest Objectif Lune representative. Contact information can be found at www.objectiflune.com.
13. LIMITATION OF LIABILITY. - IN NO EVENT SHALL OBJECTIF LUNE OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS, LOSS OF PROFITS OR SAVINGS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR THE PROVISION OF OR THE FAILURE TO
PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIF LUNE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY CASE, OBJECTIF LUNE’S ENTIRE LIABILITY
UNDER ANY PROVISION OF THIS LICENSE AGREEMENT SHALL BE LIMITED TO THE GREATER OF: A) THE AMOUNT PAID FOR THE PURCHASE OF THE SOFTWARE OR B)
CAD $25.
14. WARNING ? HIGH RISK ACTIVITIES. - THE SOFTWARE IS NOT FAULT-TOLERANT AND IS NOT DESIGNED, MANUFACTURED OR INTENDED FOR USE OR RESALE AS ONLINE CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE PERFORMANCE, SUCH AS, WITHOUT LIMITATION, IN THE OPERATION OF NUCLEAR
FACILITIES, AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE SUPPORT MACHINES OR WEAPONS SYSTEMS, IN WHICH THE
FAILURE OF THE SOFTWARE COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE (“HIGH RISK ACTIVITIES”).
OBJECTIF LUNE AND ITS SUPPLIERS SPECIFICALLY DISCLAIM ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
15. GENERAL PROVISIONS. - This License Agreement may only be modified in writing by a duly authorized officer of Objectif Lune. If any or part of any provision of
this License Agreement is, by final judgment, found void or unenforceable, the remainder shall remain valid and enforceable according to its terms. Even if any remedy provided is determined to have failed for its essential purpose, all limitations of liability and exclusions of damages herein set forth shall remain in full force and
effect.
16. GOVERNING LAW. This License Agreement is governed by the laws in force in the Province of Québec (Canada) and parties hereby elect domicile in judicial district
of Montréal, Québec, Canada. This Agreement is not governed by the United Nations Convention on Contracts for the International Sale of Goods (CISG), the application of which being expressly exclud ed.
17. U.S. GOVERNMENT RESTRICTED RIGHTS. - If a Licensed Application is acquired under the terms of a proposal or agreement with the United States Governm ent or
any contractor therefor, the Licensed Application is subject to the following restricted rights notice: “This Software is commercial computer software provided with
RESTRICTED RIGHTS. Use, duplication, or disclosure by the U.S. Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical
Data and Computer Software clause at DFARS 252.227-7013, FAR 52.227-17 Alternate III (g)(3), or subparagraphs (c)(1) and (2) of the Commercial Computer Software -- Restricted Rights at 48 CFR 52.227-19, as applicable, and their successor provisions. Contractor/Manufacturer is Objectif Lune Inc., Montréal, Québec, Canada, H1V 2C8.
18. U.S. EXPORT RULES. - You agree that the Software will not be shipped, transferred or exported into any country or used in any manner prohibited by the United
States Export Administration Act or any other export laws, restrictions or regulations (collectively the “Export Laws”). In add
export controlled items under the Export Laws, you represent and warrant that you are not a citizen of or otherwise located within an embargoed nation (including,
without limitation, Iran, Iraq, Syria, Sudan, Libya, Cuba, North Korea and Serbia) and that you are not otherwise prohibited under the Export Laws from receiving the
Software. All rights to use the Software are granted on condition that such rights are forfeited if you fail to comply with the terms of this paragraph.
This section introduces the PlanetPress Talk scripting language, describes where and how you can enter
PlanetPress Talk code in PlanetPress Design, explains its syntax and each of its elements, and offers some
tips and tricks for writing PlanetPress Talk scripts.
In this section, you learn to:
• “Learn PlanetPress Talk” on page 18
• “Integrate PlanetPress Talk into Documents” on page 19
• “Define and Assign Values to Variables” on page 20
• “Select Data” on page 20
1
1
PlanetPress Talk Basics
• “Use Functions as Arguments” on page 21
• “Debug Scripts” on page 21
• “Tips and Tricks” on page 22
In this section, you find examples of how you can use PlanetPress Talk to do the following:
• “Print a variable number of copies of a page based on a value in the datastream” on page 23
• “Store two lines of input data on one line of the data page” on page 24
• “Print a page n-up” on page 25
• “Print a line of text on odd-numbered pages” on page 26
• “Determine the proper page to print based on the width of the data in the data page” on page 27
In this section you will be able to answer the following questions:
• “What background does the PlanetPress Talk Language Reference assume?” on page 2
• “What is PlanetPress Talk and where can I use it in the documents I create?” on page 3
• “What terms does the PlanetPress Talk Language Reference use?” on page 4
• “What are the elements of the PlanetPress Talk scripting language?” on page 5
• “What are the rules for creating PlanetPress Talk scripts?” on page 6
• “What data types are available in PlanetPress Talk?” on page 8
• “What are variables?” on page 13
• “What is a runpage?” on page 14
• “Can PlanetPress Talk let me use foreign language text in PlanetPress Design?” on page 14
Key Concepts
Assumed Knowledge
What background does the
The PlanetPress Talk Language Reference does not provide information on the art and science of computer
programming. It assumes readers already have a solid grasp of programming concepts and techniques.
2
PlanetPress Talk Language Reference
assume?
PlanetPress Talk
What is PlanetPress Talk and where can I use it in the documents I create?
PlanetPress Talk is a scripting language developed by Objectif Lune, and described in detail in the
PlanetPress Talk Language Reference.
You can use PlanetPress Talk expressions in many places in the documents you create in PlanetPress
Design. You can enter a PlanetPress Talk expression in any text box with a maroon label.
You can also include complete PlanetPress Talk programs in your document. This provides the power and
flexibility that make even the most complex documents possible in PlanetPress Design. You enter
PlanetPress Talk programs when you create a user-defined emulation, and when you edit the PlanetPress
Talk properties of an object, a page, a document, or a condition. When you edit the PlanetPress Talk
properties, you can enter PlanetPress Talk code directly, or through the PlanetPress Talk Editor.
Finally, you can also write your own PlanetPress Talk functions from PlanetPress Design, making it easy to
extend the language to suit the requirements of your particular document or documents. When you write
programs in PlanetPress Talk, you should work through the logic of the program you intend to create
before you start coding. This ensures the program accomplishes what you intend it to accomplish, and
makes the coding more straightforward. It can also result in insights into different ways of accomplishing
the same task, or raise issues that were not immediately apparent.
Note that PlanetPress Talk is case-insensitive.
Learning PlanetPress Talk
One of the most efficient ways to familiarize yourself with PlanetPress Talk is to create an object, convert
it to PlanetPress Talk, and examine the code, consulting the PlanetPress Talk Language Reference as
necessary for explanations of each line of code. You can further verify your understanding by modifying
the code and observing the changes that occur in the object as a result.
As an example of this technique, the following is the code for a converted data selection object. The data
selection is from columns 1 through 12 on line 1 of the data page.
moveto(0,0)
setstyle(&Default)
margin(0,0.167)
rmoveto(stringwidth(''),0)
rmoveto(neg(stringwidth('')),0)
show(@(1,1,12))
Consider what each line of the code accomplishes, and notice that parameters to a function or procedure
may themselves be PlanetPress Talk expressions.
Command:Tells the document to:
moveto(0,0)
Move the drawing pen to the top left of the object.
3
1
PlanetPress Talk Basics
Command:Tells the document to:
setstyle(&Default)
margin(0,0.167)
rmoveto(stringwidth(' '),0)
rmove to(n eg(s trin gwid th(' ' )),0 )
show(@(1,1,12))
Set the style for the data selection to the default style
Set the offset for the text, relative to the top left of the object.
Move the pen forward the width of the data selection. Here, the
purpose of this line is to set a bounding box that appears around the
data selection object in the document design window. The
bounding box does not print but is a visual cue that keeps the object
visible even when its contents are empty.
Move the pen backward the width of the data selection. This resets
the pen to its position prior to executing the previous command. It
ensures the previous command does not alter the position of the
data selection.
Display the text that appears from columns 1 through 12 on line 1
of the current data page.
At this point you might want to introduce other commands into the code, or modify some commands and
verify the changes produce the result you expect. Or perhaps you want to create a new data selection that
starts in the middle of the data page and extends over several lines to see how PlanetPress Talk handles
multi-line data selections.
PlanetPress Talk Terminology
What terms does the
The PlanetPress Talk Language Reference uses the following terms:
Term:Is:
commandA generic term that encompasses operators, functions, procedures, condition structures,
expressionA piece of PlanetPress Talk code that includes at least one command and is at most one line
statementA single line of PlanetPress Talk code. For example:
script or
program
4
PlanetPress Talk Language Reference
and loop structures.
in length. For example:
&area := (&width * &height)
define(&max, integer, strtoint(@(1,1,4)))
A sequence of one or more lines of PlanetPress Talk code, executed sequentially. For
example the following script draws a filled shape:
What are the elements of the PlanetPress Talk scripting language?
PlanetPress Talk includes all of the features one expects in a scripting language. It has a defined set of data
types (see “Data Types” on page 8) and the following categories of elements that you use to build scripts:
Category:Description:
VariablesA variable is a value that changes over time. See “Variables” on page 13.
System objectsAn object is a set of related system variables. For example the
contains the system variables that describe the current x and y coordinates of the drawing
pen on the physical page. You reference one of the system variables in an object by prefixing
the name of the system object to the name of the variable. For example
references the x coordinate system variable in the physical system object.
Operators and
Operator functions
ProceduresA procedure performs an action. For example the
FunctionsA function performs an action and returns a value. For example the
Loop structuresRepeat a sequence of one or more commands until a specified condition is met. See “Loop
Condition structuresControl when a sequence of one or more commands executes. See “ Condition Structures” on
CommentsProvide a means for embedding documentation in your code, or for commenting out lines
An operator is a symbol that performs a common operation. For example, the
operator that adds two numbers together or concatenates two strings. An operator function
is an operator that does not use a symbol to represent its operation. For example the
command is an operator function. Both operators and operator functions operate on one or
more operands. For example the
(the operands). See “Operators and Operator Functions” on page 44 for a complete list of all
operators and operator functions available in PlanetPress Talk.
add command operates on two measure or integer values
curveto procedure draws a Bezier curve,
the
rectangle procedure draws a rectangle, and the setfillcolor procedure sets the fill
color. Most procedures require arguments. For example, the
six arguments: the x and y coordinates of the upper left hand corner of the rectangle, the
width and height of the rectangle, and whether it is filled and/or stroked.
converts an integer to a string, and returns the value of the resulting string. A function thus
has a data type that corresponds to that of the value it returns. You assign the result of a
function to a variable or use it as an argument in another command. Most functions require
arguments. For example the
want to convert to a string; it returns a string a nd thus the
Structures” on page 48.
page 48.
of code during debugging. See “% (procedure)” on page 62.
inttostr command requires a single argument: the integer you
physical system object
&physical.x
+ is an
add
rectangle procedure requires
inttostr function
inttostr fu nct ion is of t yp e st ri ng.
5
1
PlanetPress Talk Basics
PlanetPress Talk Syntax
What are the rules for creating PlanetPress Talk scripts?
The rules, or syntax, of the PlanetPress Talk language describe how you combine its elements to create
scripts.
Command Syntax
A PlanetPress Talk command has the form:
command_name( arguments )
Arguments can be constants, variables, or functions (see “Use Functions as Arguments” on page 21).
A command can require no arguments, or one or more arguments. When a command requires more than
one argument, you separate arguments by commas. The following are all examples of valid PlanetPress
Talk commands:
fill()
moveto( 2.2, 4.5 )
mul(4.7,2.1)
rectangle(0,0,3,3,true,true)
curveto(1,1,1,3,0.5,2)
set(¤t.line,¤t.line + 1)
store(¤t.line,trimleft(&str))
strtoint( @( 12,30,35) )
Spaces are not significant in PlanetPress Talk except between the name of a command and its opening
parenthesis. An error occurs if you leave a space between the name of a command and its opening
parenthesis.
show('this syntax is correct')
show ('this syntax produces an error')
Comments
PlanetPress Talk allows the use of comments within the code, but adding a comment at the end of a
PlanetPress Talk command is not permitted.
Case
PlanetPress Talk is case insensitive. Thus the following commands are all equivalent:
showright(@(1,34,64))
ShowRight(@(1,34,64))
SHOWRIGHT(@(1,34,64))
6
It is important to understand that arguments to commands are case sensitive. For example, the following
command returns False:
eq('bovine','Bovine')
Unit of Measure
Unless otherwise specified, the unit of measure in PlanetPress Talk is inch. Thus, for example, the
following line of code moves the current point to the X coordinate 1.5 inches, and the Y coordinate 2.5
inches.
moveto(1.5,2.5)
Statement or Expression Evaluation
The PlanetPress Talk interpreter uses parentheses to determine the order in which to evaluate the
individual parts of an expression or statement. It evaluates an expression or statement from the innermost
to the outermost set of parentheses. For example, consider the statement:
The interpreter first evaluates the data selection function (@), then the strip function (strip), then the start
position function (pos), and finally the if function.
The rule that says that multiplications and divisions should be performed before additions and
substractions, known as operator precedence, is not supported in PlanetPress Talk, so you should use
parentheses to simulate operator precedence. For example, if you use the equation 2 + 3 x 4, PlanetPress
Talk will calculate a total of 20, but if you use the equation 2 + (3 x 4), PlanetPress Talk will calculate a total
of 14.
Apostrophes and Backslashes within Strings
If you want to use an apostrophe (‘) or a backslash (\) within a string, you must precede it by a backslash.
For example:
show( 'Don\'t miss this offer!' )
Names
The names of any variables, global functions, objects, or styles you create with PlanetPress Talk must meet
the following requirements:
7
1
PlanetPress Talk Basics
• Names must be unique (no two elements in a document can have the same name).
• Names cannot begin with a number, and can contain only the following ASCII characters: underscore,
upper and lower case letters of the alphabet, all digits 0 through 9. If you use an underscore in the name,
it should not appear as either the first or last character of the name as this may cause internal conflicts in
the software.
• Names can be a maximum of 50 characters in length.
• PlanetPress Talk variable and command names are reserved words; you cannot use any of these reserved
words as a name.
It is always recom mended that you c hoose a name that reflects the content or purpose of the element you
are creating. A meaningful name makes it easier to distinguish one element from another, and thus makes
a document easier to maintain.
Data Types
What data types are available in PlanetPress Talk?
PlanetPress Talk provides the following data types:
Data TypeExample
Integer3
Measure or Floating Point3,2300987
Currency5.25
StringMichel or $4,567.09
BooleanYes or No
Color Array (CMYK)[100, 100, 0, 0]
Array[Monday Tuesday Wednesday Thursday Friday]
(a seven-element array of type string)
[12 18 103 57]
(a four-element array of type integer)
[True True False False True False False]
(a seven-element array of type Boolean)
Directory[c:\images\house.jpg c:\images\apt.jpg]
(a directory that contains two pathnames)
PlanetPress Talk strictly enforces its data types. For example, the show command accepts a string as its
argument; an error occurs if you attempt to send it an integer as an argument. You can use any of the
8
conversion operators PlanetPress Talk provides to convert from one type to another. Thus the following
show command is correct:
show(inttostr(subreccount()))
See “Conversion Operator Functions” on page 46 for a complete list of the operators you can use to convert
from one type to another.
Integers
You use integers for counters and simple calculations. Integers have no decimal precision.
IntegerLimit
Smallest on screen-2147483648
Largest on screen+2147483647
Smallest PostScript-2147483648
Largest PostScript+2147483647
Measures
Measures are real numbers and are often called floating-point numbers. Measures have a precision of
approximately 8 decimal places, with exact precision implementation dependent. If your document
requires complex mathematical computations in which a greater decimal precision is critical, it is
recommended you perform those calculations outside PlanetPress Design and include the result in the
input data.
MeasureLimit
Smallest on screen1.5 * 10
Largest on screen3.4 * 10
Smallest PostScript10
Largest PostScript10
-45
38
-38
38
Currency
Currency is a specific type of measure intended for use with numbers that represent monetary values. The
currency type has a precision of 4 decimal places, and can take on a minimum value of
-99999999999999.9999 and a maximum value of +99999999999999.9999. The only operations you can
perform on a currency type are addition, subtraction, multiplication and division, and negation.
9
1
PlanetPress Talk Basics
Strings
A string is a sequence of one or more alphanumeric characters. You often use strings to display information
on a page. You must enclose strings in single quotes, for example 'mystring'.
StringLength, in characters
Maximum on screen2147483647
Maximum PostScript65535
Booleans
Booleans have a value of either True or False. Every condition you define in PlanetPress Design resolves to
a Boolean value.
Color Array
A color array defines the percentages of Cyan, Magenta, Yellow and Black (CMYK) that compose a specific
color. The array consists of four integers representing, respectively, the percentages of cyan, magenta,
yellow and black that compose the color. The integers are separated by commas and enclosed in square
brackets. For example the color array [100, 100, 0, 0] represents the pure blue that corresponds to the RGB
values (0, 0, 255). It defines pure blue as 100% cyan, 100% magenta, 0% yellow, and 0% black.
Color arrays are primarily used internally by the PlanetPress Talk interpreter. However there are a handful
of commands that expect a color array as an argument (setfillcolor for example).
10
Arrays
An array is a table of values of the same data type. You reference each element of the array (each cell of the
table) independently. Arrays can be of type Boolean, integer, measure, currency, or string. The type of the
array defines the type of values each of its elements can contain. Thus in a Boolean array, the value of each
element is either True or False, and in a string array each element is a string value.
Arrays in PlanetPress Talk are one-dimensional. If you are not familiar with arrays from other
programming or scripting languages, you can think of a one-dimensional array as a single row of a table.
You specify the number of elements you want the array to contain, and initialize each of the elements,
when you define the array. Note that you cannot subsequently increase or decrease the number of
elements in an array. If you are uncertain of the exact number of elements the array may need to contain
at runtime, you may want to create an array that can handle the most extreme case you expect the
document to encounter at runtime. Note however that increasing the size of the array increases the
memory required for the document, and that it is good programming practice not to create arrays that are
larger than what the document requires to execute properly. An array in PlanetPress Design can have a
maximum of 65,535 elements.
You define an array using the define() command, and assign values to individual elements using the
assignment operator (:=), the set() command or the put() command. You retrieve the value of an
individual element using either the get() command, or the name of the array followed by the position of
that element in the array. The position is an integer value starting at 0 for the first element of the array,
and incrementing by one for each additional element. See “Define (procedure)” on page 83, “Set
(procedure)” on page 136, “Put (procedure)” on page 127, and “Get (function)” on page 100.
As an example, consider &tax_rates, an integer array containing five elements (10 20 30 40 50). You
define the array as follows:
You can use any of the following to change the value of the third element from 30 to 32.
&tax_rates[2] := 32
&tax_rates, 2, 32
put( &tax_rates, 2, 32 )
You can use any of the following to reference the third element in the array:
&tax_rates[2]
get(&tax_rates, 2)
For example:
&due := mul( &gross,&tax_rates[2] )
&due := mul( &gross,get(&tax_rates,2) )
Directory
The directory type is a type of string array in which each element in the array contains a pathname. All
pathnames in the array reference a file in the same folder. The number of elements in the array, and the
initial value of each element are both determined dynamically at the time the array is created. You specify
the folder, and the filter you want to apply to the list of files in that folder. When PlanetPress Talk creates
the array, it locates the folder you specified, applies the filter to the list of files that folder contains, and
then for each file that meets the filter criteria, adds its pathname to the directory array. Pathnames may
be either printer pathnames or host pathnames.
You can subsequently set the value of any of the elements in the array, as you would for any element in an
array of type string.
Code Sample Example 1
Example 1 uses a directory on the root drive of a printer.
Example 1
define(&MyVar,directory,'*') %root of the printer
11
1
PlanetPress Talk Basics
Code Sample Example 2
Example 2 defines a directory array in which each element in the array contains a pathname to an image
in EPS format in the folder c:\images.
Example 3 prints a list of all of the pathnames in that array.
Example 3
define( &i, integer, 0 )
for( &i, 0, 1, length( &image_paths ) - 1 )
show( &image_paths[&i] )
crlf( 0.16 )
endfor()
Code Sample Example 4
Example 4 displays each of the images referenced by the array, at a resolution of 100 pixels per inch, scaled
to a 'best fit' with a one-inch by one-inch rectangle.
12
Example 4
for( &i, 0, 1, length( &image_paths ) - 1 )
showbitmap( &image_paths[&i], 100, 1, 1 )
crlf( epsheight( &image_paths[&i] ) )
endfor()
Code Sample Example 5
Example 5 prints either an image, or, if the image cannot be found, the pathname to the image.
Example 5
define( &i, integer, 1 )
if( resourcetype( &image_paths[&i] ) <> 0 )
showbitmap( &image_paths[&i], 300, 0, 0)
crlf( epsheight( &image_paths[&i] ) )
elseif()
show( &image_paths[&i] )
crlf( 0.16 )
endif()
Variables
What are variables?
A variable is a value that changes over time, that has a specific type, and a defined scope. Variables have
names to make it possible to reference them. All variable names in PlanetPress begin with an ampersand.
For example, &printermode.
Typ e Th e ty pe of a var iab le def ine s w hat kin d of dat a it contains and consequently what kinds of operations
you can perform on it. The following are the data types available in PlanetPress Talk: integer, measure,
currency, string, boolean, array, color array, and directory. See “Data Types” on page 8.
Scope The scope of a variable is the context in which it is available. There are two possible scopes: local and
global. A local scope means the variable is available only in the specific area of an object or group in which
it is defined, and a global scope means the variable is available anywhere you can enter PlanetPress Talk
code. The way you define a variable determines its scope. The variables you define using the define
command have a local scope limited to the area of the object or group in which you define them. The
variables you define as global variables in PlanetPress Design have a global scope. Global variables in
PlanetPress Design appear in the Global Variables area of TreeView.
There are a number of ways to use variables in documents. See the PlanetPress Design User Guide for
examples of some of the most common uses people make of variables.
Local, Global, and System Variables
There are three categories of variables in PlanetPress Talk: system, global, and local.
1System Variables
System variables are variables that the system defines. There are two types of system variables: system
variables with a global scope and system variables with a local scope.
System variables with a global scope System variables with a global scope are available anywhere you
can insert a PlanetPress Talk expression in PlanetPress Design. You can use the value of a system
variable with a global scope but you cannot, except in one or two cases, modify it.
System variables with a local scope System variables with a local scope are available only within a welldefined context. There are currently two system variables with a local scope: &height and &width.
Both are local to a specific object, group, or page. The system initializes &height and &width to,
13
1
PlanetPress Talk Basics
respectively, the values of the Height and Width properties of the object, group, or page, as they
appear in the Basic Attributes of that object, group, or page.
See “System Variables with Global Scope” on page 42 for a complete list of the system variables
available in PlanetPress Talk.
2 Global Variables
Global variables are variables that you define using the Global Variable Properties dialog box in
PlanetPress Design. Global variables appear in TreeView in PlanetPress Design. Global variables have a
global scope; you can reference global variables anywhere you can insert a PlanetPress Talk expression
in PlanetPress Design.
You cannot define a global variable with the same name as a system variable.
3 Local Variables
Local variables are variables that you define using the PlanetPress Talk define command. Local
variables have a local scope; you can reference them only within the area of the object in which you
create them. You can create local variables within the PlanetPress Talk properties of an object or
group, within the Text property of a text/box object, and within the PlanetPress Talk Code property of
a PlanetPress Talk object.
14
You should never define a local variable with the same name as a system variable.
Runpage
What is a runpage?
A runpage is a normal page containing a PlanetPress Talk object that controls the execution of the pages
in the document. Although nothing prevents a runpage from containing printable elements, in most cases
it serves only to control the execution of the other pages in the document and does not itself print.
Using Foreign Language Text with PPtalk
Can PlanetPress Talk let me use foreign language text in PlanetPress Design?
You can use Text objects to display both static text and variable content, such as data selections, in the
same object. Text objects also let you mix foreign language text, such as Arabic, and European language
styles within the same object, although not in the same paragraph.
Adding Foreign Text
The Text objects dialog box lets you enter foreign language text, such as Arabic, directly in the Text area
(granted that the corresponding foreign language text feature is enabled in Windows).
Using Global Variables
If you use a Global variable containing a foreign language text string within a Text object, you must map
the characters included in that non-Unicode text string to UTF8. To do this, you must use the mapUTF8
function. You can do this by placing a PlanetPress Talk object above the Text object in the Document
Structure or in the Text object itself using the PlanetPress Talk Before properties.
Using Dynamic Data within Local Text Variables
You can add dynamic data to a Text object by using custom data selections. If you do so , you must use the
mapUTF8 function within the definition of each custom data selection.
Tex t Dir ection
A new setting was added to the paragraph options to enable right-to-left text display for paragraphs
associated with a foreign language text style.
A
B
C
A. Arabic style ; B. Right to left tex t option available when an Arabic style is selected ; C. Static tex t and data selection as edited
within the Text objects dialog box.
15
1
PlanetPress Talk Basics
Foreign Language Text within PlanetPress Talk Objects
You can use PlanetPress Talk objects to display either static text or variable content. You would typically
add a paragraph for static text or a simple field for variable information, such as a client’s name or address.
A. A PlanetPress Talk object created without defining a UTF8 paragraph ; B. Another PlanetPress Talk object, created this time
with UTF8 paragraph properties (the paragraph is justified on both sides)
If you need a string, that may contain variable content, you can use the ShowUTF8Left, ShowUTF8Center
and ShowUTF8Right commands. Note that if you choose to display a box around objects that include any of
these commands, the box may not be perfectly drawn. Pages that include many objects with these commands
will not display as fast as other pages.
If you need a paragraph, that may only contain static text, you must use the BeginUTF8Paragraph and
EndUTF8Paragraph procedures along with the ShowUTF8 command.
A
B
16
The following illustration shows the properties of a PlanetPress Talk object that creates a paragraph
containing Arabic text. The code associated with this object is also displayed in the PlanetPress Talk Editor.
A
B
C
A. The properties of a PlanetPress Talk object created to display Arabic text; B. The complete PlanetPress Talk code, as displayed
in the PlanetPress Talk Editor; C. All the characters included in the text string, with the exception of the basic ASCII characters,
are converted to their Unicode reference by the Ansi/UTF8 Converter dialog box
The illustration below shows the properties of a PlanetPress Talk object that creates an Arabic text string.
The code of a PlanetPress Talk object that displays a UTF8 static text string
17
1
PlanetPress Talk Basics
A dialog box that lets you enter arabic text has also been added. If you place the cursor within a text string
and press CTRL+N, the Arabic Converter dialog box will be displayed. When you are finished, click OK. The
dialog box will be closed and the Arabic characters will be converted to their Unicode equivalent.
The Arabic Converter dialog box also includes number conversion options that can be used to convert
numbers to either Arabic or Farsi.
To enter variable content, you can use a data selection. Use the right-click menu to display the Data
Selector and select either a location within the data or a given field in the case of a database.
Once the data has been selected, the data reference appears as a parameter.
Detailed Directions
Learn PlanetPress Talk
An efficient way to learn PlanetPress Talk is as follows. Consult the PlanetPress Design User Guide for an
example of this approach using a data selection object.
1 Get a feel for the different system variables, operators, and commands PlanetPress Talk provides (read
through the “PlanetPress Talk Summary” on page 41).
2 Create an object in PlanetPress Design, convert it to PlanetPress Talk and examine the code, consulting
the PlanetPress Talk Language Reference as necessary for explanations of each line of code.
3 Once you understand code for that object, verify your understanding by modifying it and observing the
changes that occur in the object as a result.
Note that PlanetPress Talk has many similarities to the PostScript language, and programmers familiar
with PostScript should find PlanetPress Talk easy to learn and use. This should also hold for programmers
familiar with the Windows Application Programming Interface (API).
18
Detailed Directions
Integrate PlanetPress Talk into Documents
You can enter PlanetPress Talk code in any of the following places in PlanetPress Design. Note that in all
places except a text box that accepts PlanetPress Talk code, you can use the PlanetPress Talk Editor to enter
your scripts. The PlanetPress Talk Editor provides a rich set of features that make entering, executing, and
debugging scripts fast and efficient. For complete information on the PlanetPress Talk Editor, consult the
PlanetPress Design User Guide.
Location:Accepts:
Any text box that accepts
PlanetPress Talk code (by default
these text boxes have a maroon
label; you can change the maroon
to another color in the User Options
dialog in PlanetPress Design)
PlanetPress Talk properties of an
object, group, page, document, or
condition.
PlanetPress Talk code property of a
PlanetPress Talk object.
PlanetPress Talk properties of a
paragraph in a text/box object
User-defined emulation selection
in the Data Selector.
Global Function Properties dialog
box
Import command in the
PlanetPress Talk Editor
A single line of PlanetPress Talk code.
A PlanetPress Talk script. You can enter the script directly in the appropriate
Properties dialog box, or using the PlanetPress Talk Editor.
A PlanetPress Talk scripts. You can enter the script directly in the PlanetPress
Talk Object Properties dialog box, or using the PlanetPress Talk Editor.
A PlanetPress Talk script. You enter the script using the PlanetPress Talk Editor.
A PlanetPress Talk script. You can enter the script using the PlanetPress Talk
Editor.
A PlanetPress Talk script that defines a new PlanetPress Talk function.
A file containing a PlanetPress Talk script. For example you can write a
PlanetPress Talk script in an external text editor, save it as a .ptk file. You use
the PlanetPress Talk Editor to import and, if necessary, edit the script.
also export a script
command. This makes it easy to re-use scripts. Consult the information on the
PlanetPress Talk Editor in the PlanetPress Design User Guide for help importing
and exporting scripts.
from within the PlanetPress Talk Edito r, using the Export
Yo u c an
Shortcuts for Entering PlanetPress Talk Code
The PlanetPress Design user interface provides shortcuts for entering PlanetPress Talk code that reduce the
amount of typing that is necessary. For example, in a text box that accepts PlanetPress Talk code, or in the
PlanetPress Talk properties of an object or group, you can right-click in the text box and insert PlanetPress
Talk elements from the menu that appears. The PlanetPress Talk editor also provides a variety of ways to
insert commands without manually typing them.
19
1
PlanetPress Talk Basics
For example, consider how you might build the following expression in a text box that accepts PlanetPress
Talk code.
pos('BLACK',trimright(@(6,18,35)))
You right-click in the text box and choose Integer functions | pos. The following appears in the text box,
at the insertion point:
pos(st1,st2)
You then manually replace st1 and st2 with the arguments you want the function to use. Recall that an
argument can be a constant, a variable, or a function. You replace the first argument with the constant
value ‘BLACK’:
pos(’BLACK’,st2)
You replace the second argument by the trimright function. You highlight the second argument, right click
and choose String functions | trimright.
pos('BLACK',trimright(st2))
Finally, you insert the data selection as the argument to the trimright function. You highlight the
argument to the trimright function, right-click in the text box, choose Select data, and select the data
using the Data Selector. When you exit the Data Selector, the data selection appears as the argument for
the trimright function:
pos('BLACK',trimright(@(6,18,35)))
Consult the PlanetPress Design User Guide, and in particular the area of the PlanetPress Design user
interface you are using to enter PlanetPress Talk code, for help with the different shortcuts PlanetPress
Design provides for entering PlanetPress Talk code.
20
Define and Assign Values to Variables
You use the following PlanetPress Talk following commands to define and set variables:
Use:To:
define
set
:=Assign a value to a local or global variable.
Create a local variable.
Assign a value to a local or global variable.
Select Data
You use the @ function to select data in PlanetPress Talk. This command selects data on a single line of the
data page. For example, the following returns the string of data found on line 3, from column 12 through
30 of the current data page:
@(3,12,30)
Detailed Directions
Remember that arguments can be variables. The following returns the string of data found on line &line,
from column &col1 to column &col2 of the current data page:
@(&line, &col1, &col2)
You usually assign the result of a function to a variable or use it as an argument to another command. For
example:
&customer_name := @(&line, &col1, &col2)
You can also use the Data Selector to insert a PlanetPress Talk data selection command. This is often
quicker and more convenient than manually typing the data selection command. Consult the PlanetPress Design User Guide, and in particular the area of the PlanetPress Design user interface you are using to enter
PlanetPress Talk code, for help.
Use Functions as Arguments
You can nest functions so that the value returned by one function becomes the argument for another
function. For example, in the following example, the string returned by the @ function becomes one of two
arguments for the strip function:
strip('*',@(36,25,58))
As a more complex example, consider the following:
It returns the string ‘old’ if the data selection contains the string ‘BLACK’ and ‘new’ if it does not. When the
PlanetPress Talk interpreter evaluates the statement, it first selects the data on line 36 of the current data
page, from columns 25 through 58. It then sends that data to the strip command which removes all spaces
in the data. It then sends the data (which now contains no spaces) to the pos command, which determines
whether it contains the string ‘BLACK’. Finally, it compares the value returned by the pos command to 0,
and returns the value of that comparison to the if command.
Debug Scripts
The PlanetPress Talk Editor has a solid set of features for debugging PlanetPress Talk scripts, including
execution control, breakpoints, spies, expression evaluation, and changing the value of a variable during
execution. Consult the PlanetPress Design Talk Editor section of the PlanetPress Design User Guide for a
description of these features, and suggestions on other debugging techniques.
PlanetPress Talk includes a breakpoint command that you can enter anywhere you can enter a PlanetPress
Talk script. See “Breakpoint (procedure)” on page 74.
PlanetPress Design reports errors in PlanetPress Talk code in two places: the status bar of a dialog box
when you are entering a PlanetPress Talk expression in a text box within that dialog box, and the Messages
area of the PlanetPress Design Program Window (consult the PlanetPress Design User Guide for a
21
1
PlanetPress Talk Basics
description of the Messages area). You can also use these error reports to determine and fix problems in
your code.
Tips and Tricks
The following are useful to remember as you write your PlanetPress Talk scripts:
• Defining program logic As for any coding, when you write programs in PlanetPress Talk you should work
through the logic of the program you intend to create before you start coding. This ensures the program
accomplishes what you intend it to accomplish, and makes the coding more straightforward. It can also
result in insights into different ways of accomplishing the same task, or raise issues that were not
immediately apparent.
• Te st If you are writing a complicated script, it is recommended you use the PlanetPress Talk Editor, and
test your code regularly as you develop it. This helps you discover and solve any problems early on in the
development process.
• Simplicity As in any programming language, aim for both simplicity and clarity in your scripts.
• Using mathematical operators Enclose mathematical operators in parentheses ( ) to make your code easier
to read and therefore easier to maintain.
22
• Performing complex calculations PlanetPress Talk limits its precision to 1/1000 to optimize speed and thus
is not designed to handle complex mathematical computations. If you require greater precision you
should perform the calculation outside PlanetPress Talk and include the result in the input data for your
document.
• Case PlanetPress Talk is case-insensitive. It is good programming practice to establish case conventions
as it enhances the readability of the resulting code. It is recommended that you use lower case for all
PlanetPress Talk reserved words (names of system variables, operators, and commands) as this is the
default case convention of the PlanetPress Talk Editor.
• Indent Use indents to visually represent the structure of the script. For example, indent the commands a
loop structure encloses to make it apparent where the loop begins and ends.
• Comments Include meaningful comments in your code to make it easier to read and maintain.
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
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.
• The if (ne (&printermode,0)) statement prevents the program executing during design.
• The local variable &it is a counter.
23
1
PlanetPress Talk Basics
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
BooleanFalseThe 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.
string““
Holds the contents of a first line of data.
(the empty string)
24
Code Samples
Notes
• The search loop e xecutes when the emulation encounters a form feed character. The form feed signals
the end of a data page.
• The first if statement handles the current line of data. If the current line of data is a second line, the first
block of the statement executes; the emulation concatenates the line with the previous one and stores
the result. If the current line of data is not a second line, it sets &line to the value of this(first) line of data.
• The second if statement executes the data page if the value of ¤t.line exceeds the maximum
number of lines in a data page.
• The code toggles the value of &second. after it reads each line of data so it can determine whether the
current line of data is a first or second line.
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.
The sample uses two global variables:
Variable:Type:Initialized to: Description:
&six
&two
Integer0The code on the runpage uses this as a counter for the number
of rows (6) on the printed page. The data selection on DOCPAGE
also use this variable to set the line for the data selection.
Integer0The code on the runpage uses this as a counter for the number
• In the runpage code, the outermost for loop loops six times, and positions the copy of the page in one of
the six rows. The innermost for loop loops twice and positions the copy in one of the two columns.
• The translate statement in the runpage code positions the overlay on the print page. Remember that
the translate command sets a new point of origin so each iteration of the loop positions its copy of the
page relative to the point of origin of the last one.
• In the DOCPAGE code, the global variable &six advances the data selection with each iteration of the
outermost loop of the runpage code.
26
Print a line of text on odd-numbered pages
This sample prints a line of text only on odd-numbered pages. It uses the system integer variable
¤t.printpage, and assumes you add a PlanetPress Talk object containing this code to every page
in your document.
• If you use a runpage, you would integrate this code into the runpage code.
Code Samples
Determine the proper page to print based on the width of the data in the data page
In this sample, the document contains three different pages and a runpage that manages execution of the
three pages.
Each document page has a different page width and accommodates data of a specific line length. The code
determines which document page to use with a given data page based on the length of line 5 of the data
page. The three page widths are 198 columns, 132 columns, and 80 columns.
This chapter describes the PlanetPress Talk Editor.
Overview
You can use the PlanetPress Talk Editor to enter code as well as to run, debug, import, and export complete
PlanetPress Talk programs.
In this section, you learn to:
• “Enter a New Program in the Editor” on page 35
PlanetPress Talk Editor
• “Import or Export a Program” on page 35
• “Save a Program” on page 36
• “Print a Program” on page 36
• “Exit the PlanetPress Talk Editor” on page 37
• “Show or Hide the Commands Area or Spy List” on page 37
• “Adjust the Sizes of the Commands Area, Code Area and Spy List” on page 38
• “Expand or Collapse Command Groups” on page 38
• “Enter Commands in the Editor” on page 38
• “Use Command and Variable Name Completion” on page 40
29
2
PlanetPress Talk Editor
In this section you will be able to answer the following questions:
• “What is the PlanetPress Talk Editor?” on page 30
• “What are the features of the PlanetPress Talk Editor?” on page 31
• “What debugging features are available in the PlanetPress Talk Editor?” on page 32
• “When are the execution and debugging features of the Editor available? When I execute a program in
the Editor, what other code executes along with it?” on page 34
Key Concepts
PlanetPress Talk Editor
What is the PlanetPress Talk Editor?
The PlanetPress Talk Editor is a feature-rich editor for entering PlanetPress Talk code. You can write, run,
and debug code, as well as import and export code, all from the PlanetPress Talk Editor.
There are four main areas in the PlanetPress Talk Editor: the Commands area, the Code area, the status bar
and the Spy list.
30
AB
CD
A. Commands area B. Code area C. Status bar D. Spy list
Commands Area
The Commands area displays a list of available PlanetPress Talk commands, organized into groups. It
serves both as a quick reference as well as an easy way to enter code either by dragging and dropping, or
double-clicking a command.
Code Area
The Code area displays the PlanetPress Talk code entered to date. If the Code area is currently displaying
the contents of a file, the title bar of the window displays the path of that file.
PlanetPress Talk Editor Status Bar
The status bar displays information about the line of code that is currently under the pointer, and the
current execution status of the program.
The Editor also uses the status bar to display any conversion or run errors it encounters in the Code area
when you attempt to exit the Editor.
Spy List
The Spy list displays any and all spies set in the object or page from within which you are using the Editor.
PlanetPress Talk Editor Features
What are the features of the PlanetPress Talk Editor?
The PlanetPress Talk Editor provides the following features for entering, editing, and executing code..
Feature:Description:
Easily customized appearance and
behavior
Flexible code entry The Editor provides several ways to enter code, and it includes a number of
You can set a number of options that affect the appearance and behavior of
the Editor.
features to enhance the speed and efficien cy of code entry. You can enter code
in the PlanetPress Talk Editor by dragging and dropping commands from the
Commands area, double-clicking commands in the Commands area, or by
typing commands directly in the Code area as you would in a text editor.
When you type commands directly in the Code area, the command name
completion can enhance the speed and accuracy of command entry.
The Editor also provides a number of ways to enter arguments into a
command, and makes it easy to quickly display a list of the arguments a
command requires.
31
2
PlanetPress Talk Editor
Feature:Description:
Syntax highlightingYou can use syntax highlighting to make the different elements of the code in
the Code area easier to distinguish visually. For example, you might choose to
display all command names in a bold font with the color set to black, and all
comments in a regular font with the color set to gray.
Convenient navigationYou can navigate in the Code area as you would in a text editor, using the
arrow keys, and the scrollbars that appear on the bottom and on the right of
the Code area when the code extends beyond the size of the Code area.
The Editor also provides bookmarks to make it easy to jump to a specific point
in the code, and a feature to make it easy to jump to a specific line number.
Selection and manipulation of a
region of code
Undo commandYou can undo either a single editing command, or a group of editing
Search, and search and replaceYou can perform search as well as search and replace operations in the Editor.
Program execution controlYou can run a program through to completion, advance execution only to the
Result previewYou can use the Object Preview to preview the result of execution.
Print the programYou can print the code that appears in the Code area and set a number of
Import and export programsThe Editor can import and export programs. Thus you can write code in an
Help referencesThe Commands area provides a quick reference for the PlanetPress Talk
You can select a region of code and then cut, copy, paste, or delete that region.
commands. You can also repeat the undo to continue undoing previously
entered commands or groups of commands.
pointer position, or advance execution one line of code at a time.
options that determine how the code prints.
external text editor and import it, or save the code you write in the Editor out
to a file.
language, and the command name completion feature and the argument list
display feature provide quick references for specific commands.
32
Debugging Features
What debugging features are available in the PlanetPress Talk Editor?
The Editor provides four key features that can help you debug problem programs: execution control,
breakpoints, spies, and expression evaluation. They are not available when you launch the Editor from the
PlanetPress Talk properties of a document or condition, when you are editing the PlanetPress Talk before/
after paragraph properties of a text object, or when you are creating or editing a global function.
1 Execution control
The different execution methods, in particular the Run to cursor and the Step by step methods of
executing a program, can be useful when you are debugging a program. You can exit program
execution at any point.
2 Breakpoints
A breakpoint stops the execution of the program at a specific line in the code. You can set the
breakpoint to take effect whenever the program arrives at that line, or only when the program arrives
at that line and a specified condition is True. You can set as many breakpoints as you need.
3Spies
A spy is a PlanetPress Talk expression that references one or more variables or expressions in your
PlanetPress Talk code and evaluates to a string, integer, measure, currency or Boolean value. The
expression you use for the spy may or may not be part of the existing code.
Spies are useful for monitoring variables or expressions in your PlanetPress Talk code. The spies you
create appear in the Spy list. When you execute the program, they update to reflect the changing
values of the variables they reference. Spies can reference global, system, and local variables. Note,
however, that the only local variables you can reference when you create a spy are those defined in the
program loaded in the Editor at that time.
There is one Spy list per individual object or page.
4 Expression evaluation
You can evaluate any PlanetPress Talk expression that evaluates to a string, integer, measure, currency
or Boolean value, whether or not that expression appears in the Code area of the Editor.
The value of any variable the expression references is its value at the point in program execution at
which you perform the evaluation. You can reference system variables, global variables, as well as any
local variables that appear in the program currently loaded in the Editor.
Other Features Useful in a Debugging Context
In addition to the four key debugging features, comments, debugging code, and the Object Preview can
also be useful during debugging.
Comments can be very handy for enabling or disabling sections of code.
Debugging code is code you embed in the program for debugging purposes only; during execution, it
prints information that helps you debug the program. The Messages area of the Object Preview displays
the debugging code. Once you solve the problem, you remove the debugging code.
33
2
PlanetPress Talk Editor
The Object Preview is useful both for viewing the result of code execution up to the current stop point in
the code, and for examining error messages and debugging strings.
Code Execution in the Editor
When are the execution and debugging features of the Editor available? When I execute a program in the
Editor, what other code executes along with it?
The execution and debugging features of the Editor are available only when you launch the Editor from
the PlanetPress Talk properties of an object or page, or from the Data Selector. They are not available when
you launch the Editor from the PlanetPress Talk properties of a document or condition, when you are
editing the PlanetPress Talk before/after paragraph properties of a text object, or when you are creating
or editing a global function.
The execution feature lets you preview the result of the PlanetPress Talk code using the Preview window.
When you execute a program, the Preview window displays the result of the execution up to the current
stop point in the code.
34
A
A. Messages area
It is important to understand that when you execute a program in the Editor, only in the case of a userdefined emulation is that program the only code that executes. When you execute a program from the
PlanetPress Talk properties of an object or page, the entire code for that object or page executes. This
ensures the execution respects any dependencies one section of code has on an earlier section of code.
Think of the entire code of an element as being composed of three parts:
1 PlanetPress Talk before code
The code you enter in the PlanetPress Talk before property of the element.
2Element code
This includes the code for all the other properties of the element. For example, in an object it includes
the code for the Height, Width, Left, Right, Style, Condition, and all the other properties of the object
In a PlanetPress Talk object, it includes the code you enter in the PlanetPress Talk code property. In a
page, it includes the code for all the properties of the page as well as the code for all the objects on the
page.
3 PlanetPress Talk after code
The code you enter in the PlanetPress Talk after property of the element.
When you execute a program in the Editor, the Editor executes all three parts of the element, in sequence.
You can stop execution, and use the debugging features only in the program you are currently editing in
the Editor.
Detailed Directions
Detailed Directions
Enter a New Program in the Editor
The way you create a new program in the PlanetPress Talk Editor depends on whether the Code area of the
Editor is currently displaying the contents of a file.
To create a new program when no file is loaded in the Code area:
•Enter the new program.
To create a new program when a file is loaded in the Code area:
1 If necessary, save the program currently loaded in the Code area.
2 Press CTRL+A followed by BACKSPACE to clear the Code area.
3Enter the new program.
Import or Export a Program
The file name extension .ptk indicates the file contains PlanetPress Talk code.
If a file is currently loaded in the Editor, you can also use the export procedure to save the contents of the
Code area to a different file.
35
2
PlanetPress Talk Editor
To import an existing PlanetPress Talk program:
1 Choose File | Import.
If you currently have an unsaved program in the Code area, the Editor prompts for confirmation to save
it. Once you respond to the prompt, or if no response was necessary, the Editor displays the Open dialog
box.
2In the Open dialog box, navigate to the PlanetPress Talk program you want to open and click Open.
The .ptk file name extension indicates the file contains PlanetPress Talk code.
The Editor loads the contents of the file into the Code area. The Editor does not verify that the file
contains valid PlanetPress Talk code when it loads it. You can verify the code by executing it in the
Editor and/or examining the Messages area of the Object Preview.
To export a PlanetPress Talk program:
1 In the PlanetPress Talk Editor, choose File | Export As.
2In the Save As dialog box, navigate to the folder in which you want to save the program and enter the
file name for the program.
3 Click Save.
36
Save a Program
If no file is currently loaded in the Editor, and you want to save the contents of the Code area, you use the
export procedure. You also use the export procedure if a file is currently loaded in the Editor and you want
to save the contents of the Code area to a different file.
To s ave a pro gra m:
•In the PlanetPress Talk Editor, choose File | Export.
Print a Program
To print the program:
1 If you want to print only a region of code, select that region.
2 In the PlanetPress Talk Editor, choose File | Print.
3 Adjust the print options if necessary.
FILE TO PRINT
File name: Displays the name of the file currently loaded in the Code area.
Detailed Directions
Print selected block: Select to print only the selected region of the program. Clear to print the
complete program. This option is available only if you have code selected in the Code area.
OPTIONS
Line numbers: Select to print code line numbers or clear to exclude them. The line numbers appear in
the Editor alongside the lines of code if the User Options are set to display them. Line numbers can
provide a useful reference, particularly when debugging a program.
Word wrap: Select to have any line of code that extends beyond the page wrap to the next line. The
wrap occurs on a word break. Clear to prevent the word wrap, and thus force every line of code to
occupy one line on the printed page.
Syntax print: Select to preserve the style attribute settings (Bold, Italic, Underline) set in the User
Options, in the printed output. Clear to remove these settings from the printed output. Note that
Syntax print does not work if you select Line numbers.
Left indent: Enter the left margin to use for the code on the printed page, in points. If you also select
Line numbers, this is the distance between the line numbers and the code.
4 If necessary, click Setup to display the Printer Setup dialog box and adjust the printer options.
5 Click OK.
Exit the PlanetPress Talk Editor
To exit the PlanetPress Talk Editor:
•In the PlanetPress Talk Editor, click OK.
The Editor verifies the code in the Code area. If it encounters any conversion or run errors, it displays the
offending error in the status bar and does not exit.
If the code is error-free, the Editor exits. If a file is currently loaded in the Code area, and you made
modifications to it, the Editor prompts for confirmation to save it before exiting.
Show or Hide the Commands Area or Spy List
To show or hide the Commands area:
•Choose View | Commands.
To hide the Commands area:
•Choose Close.
37
2
PlanetPress Talk Editor
To show or hide the Spy list:
•Choose View | Spy List.
Adjust the Sizes of the Commands Area, Code Area and Spy List
To adjust the relative sizes of the Commands area, Code area, and Spy list:
1 Position the pointer over the right edge of the Commands area, or the top edge of the Spy list to display
the double-headed arrow pointer.
2 Click and drag to adjust the relative sizes of the Commands area, Code area, and/or Spy list.
Expand or Collapse Command Groups
A
38
B
C
A. Expand/collapse box B. Expanded group C. Collapsed group
To expand or collapse a single command group:
•Click the expand/collapse box to the left of the group.
To expand or collapse all command groups:
•Right-click in the Commands area and choose Expand All or Collapse All.
Enter Commands in the Editor
To make code entry faster and more adaptable to different work styles, the Editor provides a number of
ways to enter code.
Detailed Directions
When you are entering commands, remember that PlanetPress Talk is case-insensitive.
To e nte r co mma nds :
•In the Code area, click and type the command. When you type commands, you may find the command
name completion feature useful.
The exact insertion point depends on the type of command. If the command is a function, the Editor
inserts it at the exact point indicated by the click in the Code area. If the command is a procedure, and
the point indicated by the click in the Code area is anywhere except the first character of the line, the
Editor inserts it after the line on which you clicked; if you clicked on the first character of a line, it inserts
it before that line.
To e nte r argumen ts:
•Use any of the following.
• Argument: You can enter any argument by typing it.
• Data selection: To enter a data selection as an argument using the Data Selector, right-click in the
Code area at the point at which you want to enter the data selection argument, and choose Data Selection.
• Color specification: To enter a color specification as an argument using the Color Picker, right-click in
the Code area at the point at which you want to enter the color specification, and choose Color.
• Style: To enter a style as an argument, right-click in the Code area at the point at which you want to
enter the style, choose Style, and then choose the style you want to reference.
• Image resource: To enter an image resource as an argument, right-click in the Code area at the point
at which you want to enter the argument, choose Image Resource, and then choose the image
resource you want to reference.
• Condition: To enter a condition as an argument, right-click in the Code area at the point at which you
want to enter the condition, choose Global Condition, and then choose the condition you want to
reference.
• System variable (from the Commands area): To enter a system variable as an argument using the
Commands area, click in the code at the point at which you want to enter the system variable. Then,
locate the variable in the Commands area (either in the All in alphabetical order group or the Other
group), and double-click it as you would to enter a command.
39
2
PlanetPress Talk Editor
• System variable (from the Code area): To enter a system variable as an argument from the Code
area, right-click in the Code area at the point at which you want to insert the system variable, choose
System Variable, then choose the variable type, and finally choose the system variable.
• Global variable: To enter a global variable as an argument using the list of global variables, rightclick in the Code area at the point at which you want to insert the global variable, choose Global Vari able, then choose the variable type, and finally choose the global variable.
• Global functions: To enter a global function as an argument using the list of global functions, rightclick in the Code area at the point at which you want to insert the global function, choose Global Function, then choose the global function.
• Any type of variable (global, local, or system) or a global function: To enter a variable of any type
or a global function as an argument, in the Code area, click in the code at the point in the argument
list at which you want to insert the variable or global function and press CTRL+SPACE. A list of
variables and commands appears. In the list, double-click the variable or global function you want to
insert, or if it is already highlighted, press ENTER, to insert it into your code. You can abort the
operation at any point by pressing ESCAPE. Note that the position of the pointer when you press
CTRL+SPACE is important. If you press CTRL+SPACE in the middle of an existing string, the Editor
performs a variable or command name completion instead of an argument insertion.
40
• Commands: To enter a command as an argument to another command, use any of the techniques
described in. You can also use the technique described above for inserting any type of variable from
the Code area.
Use Command and Variable Name Completion
To use command or variable name completion:
1 Click at the point at which you want to insert the command or variable, and type the first character or
characters of its name.
2 Press CTRL+SPACE.
PlanetPress Talk Summary
This section provides a summary of all elements in the PlanetPress Talk scripting
This summary is intended as both a way to become familiar with PlanetPress Talk, and as a quick reference
once you are familiar with PlanetPress Talk.
PlanetPress Talk includes the following types of variables:
• System Variables with Local Scope
• System Variables with Global Scope
41
3
PlanetPress Talk Summary
• System Objects with Global Scope
System Variables with Local Scope
Name:Description:
&Height
&Width
System variable with a scope local to a specific object, group, or page. The system
initializes this variable to the value of the Height property of the object’s, group’s, or
page’s Basic Attributes. You can reference and set this variable in any PlanetPress Talk
code you enter in the object, group, or page.
System variable with a scope local to a specific object or group. The system initializes
this variable to the value of the Width property of the object’s or group’s Basic
Attributes. You can reference and set this variable in any PlanetPress Talk code you
enter in the object, group, or page.
System Variables with Global Scope
Name:Description:
&EOJob
&FirstSide
&PrinterMode
&Str
Read-only variable that returns True if the document has processed the last line of
data or if the line that follows the last form feed character (ASCII 12) is empty.
Read-only variable that returns True when a page is printing on the first side of a page
in duplex mode (double-sided printing). In simplex mode (single-sided) &firstside
always returns True.
Returns the current output mode for the document. This allows you to test for a
specific value and react accordingly.
Contains a line of input data.
42
System Objects with Global Scope
Current System Object
Name:Description:
&Current.DataPage
&Current.Line
Integer value containing the page number of the current data page, or the number of
the current record set in the case of a database emulation.
Integer value containing the line number of the current line of data within the data
page, or the number of the current record within the record set. This value is readwrite and can be modified using the set command.
Name:Description:
&Current.LPP
&Current.MediaColor
&Current.MediaType
&Current.MediaWeight
&Current.MinFeature
&Current.Orientation
&Current.PageHeight
&Current.PageWidth
&Current.PrintPage
&Current.x
&Current.y
Integer value containing the number of lines per page in the current data page. In
database emulation, this value can also be used in place of the subreccount() function
to determine how many records a record set contains.
Note that contrary to the subreccount() function, the current.lpp function only returns
the correct information if you have a fixed number of records per page. If the current
record set definition is based on a field condition, the returned value will correspond
to the maximum record of the set.
String value containing the color set in the Media color box of the Page dialog box for
the current document page, or, if no value is set in that box, the color set in the Media
color box in the Document dialog box for the document. The Media color box appears
when you select Media selection in the Selection type box. Recall that the Media color
box specifies the color of paper.
String value containing the type set in the Media type box of the Page dialog box for
the current document page, or, if no value is set in that box, the type set in the Media
type box in the Document dialog box for the document. The Media type box appears
when you select Media selection in the Selection type box. Recall that the Media type
box specifies the type of paper (plain, coated, etc.).
Integer value containing the weight set in the Media weight box of the Page dialog
box for the current document page, or, if no value is set in that box, the weight set in
the Media weight box in the Document dialog box for the document. The Media
weight box appears when you select Media selection in the S election type box. Recall
that the Media weight box specifies the weight of paper, in grams per square meter.
Measure value containing the width of a single pixel at the current zoom level. Precise
to 1/65536 inch. This is the minimum size you can use in PlanetPress Talk code. If you
use a smaller value (for example as an argument in a command), PlanetPress Talk
automatically replaces that value with the value of minfeature.
Integer value containing the orientation of the current document page (0=portrait,
1=landscape, 2=Rotated portrait, 3=Rotated landscape).
Measure value containing the physical page height, in inches, of the current page in
the document.
Measure value containing the physical page width, in inches, of the current page in
the document.
Integer value containing the current page number in the document.
Measure value containing the current horizontal (x) or vertical (y) position of the
drawing pen on the current page. This value is relative to the top left corner of the
current page - whose coordinates are (0,0) - and may not necessarily be equal to the
current physical position on the page (for instance, if the page is called from a
PlanetPress Talk object located on the middle of the physical page).
43
3
PlanetPress Talk Summary
Physical System Object
Name:Description:
&Physical.x
&Physical.y
System System Object
Name:Description:
&System.Product
&System.Version
&System.FormVersion
Measure value containing the current horizontal (x) or vertical (y) position of the
drawing pen, relative to the upper left corner of the physical pa ge, whose coordinates
are (0,0). This system object can be used to assess the amount of space left on a page.
String value containing the name of the RIP the document is using to execute. For
example,
String value containing the version number of the RIP the document is using to
execute. For example, 4.0.
Integer value containing the version number of the document requested by the
trigger. Recall that you can assign a version number to a document and increment the
number each time you update and reinstall the document. When you execute a
document that uses a version number, the document verifies its version number
against the one you specify in the trigger, and it proceeds with execution only if the
two version numbers match. See the PlanetPress User Guide for more complete
information on versioning.
Operators and Operator Functions
Assignment Operator
Name: Type:Description:
:=
Mathematical Operators and Functions
Name: Type:Description:
+
Add
44
operatorAssign a value to a variable. This provides a more convenient alternative
operator
function
to the set() command. Note that spaces between the operator and its
operands are optional.
Adds two numerical expressions. This is the functional equivalent to the
+ operator, when you use the + operator with numerical expressions.
Name: Type:Description:
–
Sub
*
Mul
/
Div
Mod
–
Neg
Cos
Sin
Random
Ceil
operator
function
operator
function
operator
function
function &
procedure
functionReturns the negative value of the specified expression. This is the
functionReturns the cosine value of the specified angle.
functionReturns the sine value of the specified angle.
functionReturns a measure value between 0 and 1, non-inclusive. Since this
functionReturns the smallest integer greater than or equal to the specified
Subtracts one expression from another. This is the functional equivalent
of the - operator.
Multiplies two expressions. This is the functional equivalent of the *
operator.
Divides an expression with another. This is the functional equivalent to
the / operator.
Returns the remainder resulting from the division of two numbers.
functional equivalent to the - sign.
function uses the current system time when run inside the printer, it
returns a true random value. On the computer, however, the function
uses the current data page as its seed to ensure the returned value is
constant when you navigate from page to page on your document.
measure value.
String Operator
Name: Type:Description:
+
operatorEither concatenates two or more strings or adds two numerical
expressions, depending on its context.
Boolean Operator Functions
Name: Type:Description:
And
Not
logical
operator &
function
logical
operator &
function
Returns true if both specified expressions are true, otherwise it is false.
Negates the specified expression. Not to be confused with the neg
function: not is a Boolean operator function, not a mathematical one.
45
3
PlanetPress Talk Summary
Name: Type:Description:
Or
XOr
logical
operator &
function
logical
operator &
function
Returns true if either or both specified expressions are true, false
otherwise.
Returns true if only one of two specified expressions is true, false
otherwise.
Comparison Operators and Operator Functions
Name: Type:Description:
>=
GE
>
GT
<=
LE
<
LT
=
Eq
<>
NE
operator
function
operator
function
operator
function
operator
function
operator
function
operator
function
Compares two expressions of any type and returns true if the first is
greater than or equal to the second, false otherwise. This is the
functional equivalent to the >= operator.
Compares two expressions of any type and returns true if the first is
greater than the second, false otherwise. This is the functional
equivalent to the > operator.
Compares two expressions of any type and returns true if the first is less
than or equal to the second, false other wise. This is the functional
equivalent to the <= operator.
Compares two expressions of any type and returns true if the first is less
than the second, false otherwise. This is the functional equivalent to the
< operator.
Compares two expressions of any type and returns true if both are equal,
false otherwise. This is the functional equivalent of the = operator.
Compares two expressions of any type and returns true if they are not
equal, false otherwise. This is the functional equivalent to the <>
operator.
Counts the number of children of a specific element.
Retrieves values from an XML file.
Resets the XML root path to its default value.
Sets the XML root path.
Foreign Language Procedures and Functions
Name: Type:Description:
BeginUTF8Paragraph …
EndUTF8Paragraph
MapUTF8
ShowUTF8procedureThis command is used to display UTF8 text on the
ShowUTF8Left / ShowUTF8Right /
ShowUTF8Center
procedureDelimits a paragraph of formatted UTF8 text.
function
Converts a text string from its original encoding to
UTF8.
document.
procedureThese three commands are used to display simple
text strings on the document.
Note: When using PlanetPress Talk code to perform a line repeat directly on an object, use the reserved
word
¤titeration. The value of the iteration will increment. You can also repeat on a group
using the syntax
&group.currentiteration.
47
3
PlanetPress Talk Summary
Loop and Condition Structures
Loop Structures
Name: Type:Description:
For
...
EndFor
Repeat
...
Until
Search
...
EndSearch
Exit
procedureThis command structure allows a series of nested commands to be
procedureRepeat a sequence of commands until a condition is true. It is similar to
procedureThis command structure allows a series of nested commands to be
procedureExits from a for...endfor or repeat...until loop.
repeated a specified number of times. Each for statement must have a
corresponding endfor statement in order for PlanetPress Talk to know
which commands to include in the loop.
a for... endfor loop in that you can nest the loops. It is different from a
for... endfor loop in that the loop always executes at least once, and
that you tie the number of times the loop repeats to a Boolean
condition. For example you might tie the number of times the loop
repeats to the occurrence of a piece of data in the data stream.
repeated as long as a specific string of characters (the search string) is
found within another string (the target string). After each iteration, the
target string contains all the data between occurrences of the search
string, excluding the search string. Once the loop is over, target contains
the remaining characters of the original data.
48
Condition Structures
Name: Type:Description:
If
If
...
ElseIf
...
EndIf
functionEvaluates an expression and returns one of two specified values
according to the results of the evaluation.
procedureThis command structure can define up to two conditional blocks.
Statements nested within the first block are executed only if the
condition specified in the if statement returns true. If it returns false, the
program branches to the first statement in the second block, if one has
been defined using the elseif statement. Other wise, control flows to the
first statement following the endif command.
Commands
Add a Comment
Name: Type:Description:
%
Work with Emulations
Name: Type:Description:
SetEmulation
SetLPP
Work with Data Pages
Name: Type:Description:
ClearPage
DefineData
Find
GetNextDataPage
IsPageEmpty
SetDataPage
Store
procedureComments out the line. This is useful for embedding documentation in
your code, making it easier to read and maintain. It is also useful during
debugging, for commenting out lines of code you do not want to
execute. Note: Comments must not appear in the first line of the script
you enter in the PlanetPress Talk Editor.
procedureSets the emulation to use.
procedureSets the number of lines per data page.
procedureClears the current data page. This command should only be used before
reading the next page of data from the input stream.
procedureSpecifies the data file to use for data selections.
functionChecks for the presence of a string within a rectangular region of the
current data page. If the specified string is found, the function returns
true. This allows you to look for strings within a more general area,
rather than at some precise location.
procedureAdvance to the next data page of the sample data file. Note that this
command does not work in documents that use a user-defined
emulation.
functionReturns False if the current data page contains data, or True if it does
not.
procedureSpecify the data page of the sample data file. >>
procedureStores a string of characters on a specific line in the current data page.
49
3
PlanetPress Talk Summary
Work with Database Records
Name: Type:Description:
Field
FieldCount
FieldName
SubRecCount
functionReturns the contents of the specified field for the current record. This
functionReturns a count of fields in the current database record. Since all records
functionReturns the name of the specified field for the current record. This
functionReturns the number of records per data page. Since data pages can hold
Select or Define a Data Value
function is only useful in database emulation mode.
always hold the same number of fields, this value will not change unless
a new sample data file is used. This function is only useful in database
emulation mode.
function is only useful in database emulation mode.
a variable number of records, this value may change whenever you skip
through data pages. Every data page always has at least one child,
otherwise it wouldn't be stored in the database. Subreccount can return
0 only if the emulation is set to something other than database mode,
or if the converted database is invalid. This function is only useful in
database emulation mode.
50
Name: Type:Description:
@
DefineImageIndex
SetBodyText
SetEmailAddress
SetEmailSubject
SetFaxInformation
SetFaxNumber
SetImageIndex
functionReturns a selection within the current data page.
procedureDefines a PlanetPress Search index term. PlanetPress Image uses this
information to generate the .PDI file it creates for each PDF file it
creates. You use SetImageIndex() to associate a data value with the
index term.
procedureDefines the text that appears as the body of an email message sent by
PlanetPress Image.
procedureDefines an email address for PlanetPress Image.
procedureDefines the subject line of an email message sent by PlanetPress Image.
procedureDefines the fax description that appears in both the PlanetPress Fax
dialog box and the PlanetPress Fax log file.
procedureDefines a fax number for PlanetPress Fax.
procedureAssociates a data value with a PlanetPress Search index term defined
using the DefineImageIndex() command. PlanetPress Image uses this
information when it generates the .PDI file it creates for each PDF file it
creates.
Name: Type:Description:
SetPDFBookmark
procedureCreates a PDF bookmark at the current page, for the PDF files
PlanetPress Image generates.
Execute Documents and Document Elements
Name: Type:Description:
@page
$element
DoForm
ExecPage
ShowPage
StopJob
procedureExecutes the content of the specified document page, as if it were part
of the calling page. The content of the page in this case excludes the
paper handling properties of the page. The height and width of the
page content thus becomes the height and width of the group that
would result if you created a single group of all of the page elements. If
you want to include the paper handling properties in the page
execution, see $element (procedure).
procedureExecutes the specified document element (object, page, resource, etc.).
Note that in the case of a page, this procedure executes both the content
of the page and the paper handling properties of the page. The height
and width of the page are thus as set by the page size in the paper
handling properties of the page.
procedureRuns the current document. This command is usually issued from within
the OnReadDataPage event of the user defined emulation, once a
complete data page has been received and committed to buffer.
procedureExecutes the content of the specified document page, as if it were part
of the calling page. The content of the page in this case excludes the
paper handling properties of the page. If you want to include the paper
handling properties in the page execution, see $element (procedure).
procedureInstructs the printer to output the page and move on to the next
instruction.
procedureTerminates execution of the document and returns control to the
PostScript interpreter.
Work with PostScript
Name: Type:Description:
PassThrough
RunPS
procedureSends a literal PostScript command to the printer.
procedureCalls resources, usually images, downloaded with the PlanetPress
Watch imag e.
51
3
PlanetPress Talk Summary
Work with PPDs
Name: Type:Description:
CallPPD
SelectMedia
procedureCalls a section of the PostScript Printer Description (PPD) file and
executes it on the printer. Use this to set printer options such as the
input tray or duplexing options. The tokens and subtokens you use as
arguments with this function must be defined in the PPD file associated
with your document or page in the document’s or page’s Basic
Attributes. PlanetPress searches the PPD file for the token-subtoken
combination and then prompts the printer to execute the
corresponding code.
procedureOn screen, displays the physical page. On a PostScript printer, calls the
specified paper.
Save and Restore the Current Graphics State
Name: Type:Description:
GSave
GRestore
procedureThis command saves all current system parameters, which can later be
restored using the grestore command. By bracketing parts of your
PlanetPress Talk programs with gsave/grestore commands, you can
make sure the current system state is preserved and remains unaffected
by whatever operations your program executes. For instance, each
PlanetPress object, once converted to its PlanetPress Talk scripting
language equivalent, begins with a gsave command and ends with a
grestore, thus ensuring objects do not interfere with each other, or with
the system.
procedureThis command restores all system parameters previously saved with the
gsave command. If no gsave command was issued previously, the
results are unpredictable. For more information, refer to the gsave
command.
52
Work with Global Functions
Name: Type:Description:
@name
functionCalls and executes a function or procedure created using the function()
command.
Name: Type:Description:
Function
Define and Assign Values to Variables
procedureDefines a new PlanetPress Talk function or procedure. If you define a
function that you want to return a value, you assign that value to the
predefined variable &result on the last line of the function definition.
You call the function or procedure you define using the @name()
command. See “Function @name (procedure)” on page 96.
Name: Type:Description:
Define
Set
procedureThis command creates a new local variable, or redefines an existing one.
The define procedure must appear before the variable is actually used.
It is considered good practice to define all your variables at the top of
your program.
procedureThis command assigns a new value to a variable. Only user-defined
variables can be set. System variables are read-only. Note that you can
also use the assignment operator to assign a value to a variable. See “Set
(procedure)” on page 136.
Work with Objects
Name: Type:Description:
Object
Tra nsl ate
procedureCreates an object. You can reference the object you create using the $
operator. See “Object $name()... EndObject (procedure)” on page 119.
procedureOffsets an object's position from its original spot on the page. The point
of origin of any object is (0,0) by default. All commands within an object
are relative to that point of origin. Moving, or translating the point of
origin allows you to reset the point of origin within the boundaries of
the object.
Work with Bar Codes
Name: Type:Description:
C128 functionConverts a two-character string to Code 128 bar code, character set C
data.
ShowBarCode
procedureDisplays a specified string as a barcode.
functionReturns the width or height, in inches, of a bitmap image resource, at
functionReturns the width or height, in inches, of an Encapsulated PostScript
procedureCeate an alias for a resource file (image, data file, attachment, etc.). You
functionReturns the width or height, in inches, of a page of a Portable Document
functionReturns the number of pages in the specified PDF file.
functionReturns the height, in pixels, of the specified image. >>
functionReturns the width, in pixels, of the specified image.
procedureDisplays a bitmap resource.
procedureDisplays an EPS image resource.
procedureDisplays a page of a PDF image resource.
functionReturns the type of a resource. Recall that resources are either images or
the specified resolution.
(EPS) image resource.
can then reference the resource file using the alias instead of the path.
This eliminates the need to repeat a pat h in mo re than one pl ace in your
code, and thus makes your code easier to maintain. For example, if you
change the resource, you need only modify the path in the instream()
command, rather than everywhere you reference the original resource.
Format (PDF) image resource.
attachments.
54
Work with Text
Name: Type:Description:
CRLF
BeginParagraph
...
EndParagraph
procedureMoves the current point by simulating a carriage return/line feed
combination. The horizontal position is reset to the value of the current
left margin, while the vertical position is offset by the leading value
specified.
procedureDelimits a paragraph of formatted text.
Name: Type:Description:
Margin
Show
ShowCenter
ShowRight
ShowLeftRight
procedureOffsets text within a series of commands, relative to the original top left
position of the object. Margin also sets the horizontal position to be
used when crlf commands are encountered. All text-rendering
functions that make use of margins use this setting.
procedureThese three commands are used to display simple text on the
document. They are identical in all aspects, except in the way they
behave relative to the current margin settings: show u ses t he ma rgin as
a starting point to extend the string to the right; showright uses the
margin as the ending point of the string; and showcenter extends the
string equally on both sides of the margin.
procedureDisplays a string of characters, in inches, using a specified width.
Work with Styles
Name: Type:Description:
SetStyle
SetStyleExt
procedureSets the style to be used for all subsequent commands. The specified
style must already exist in the document.
procedureSelect an existing style and set the size, color, style property, or font
ratio for its font. This eliminates the need to create several styles that
use the same font. setstyleext() does not support bold, italic, or
underline styles with double-byte character sets.
Work with Strings
Name: Type:Description:
+
Find
IsNumber
Left
Length
LowerCase
operatorEither concatenates two or more strings or adds two numerical
expressions, depending on its context.
functionChecks for the presence of a string within a rectangular region of the
current data page. If the specified string is found, the function returns
true. This allows you to look for strings within a more general area,
rather than at some precise location.
functionTests a string and returns true if the string is a measure or integer value.
functionExtracts the specified leftmost characters of a string.
functionReturns the length of a string, or the number of elements in an array.
functionConvert a string to all lower case characters.
55
3
PlanetPress Talk Summary
Name: Type:Description:
Mid
Pos
Right
Search
functionExtracts a specified number of characters from a string, starting at a
functionReturns the starting position of a specified string within another string,
functionExtracts the specified rightmost characters of a string.
procedureThis command structure allows a series of nested commands to be
...
EndSearch
ShowLeftRight
StringReplace
StringWidth
Strip
Tri m
Tri mLe ft
Tri mR igh t
UpperCase
procedureDisplays a string of characters, in inches, using a specified width.
functionReplaces all occurrences of a pattern within a string, with another
functionReturns the physical display width, in inches, of a string.
functionRemoves all occurrences of a string within another string.
functionRemoves both leading and trailing spaces from a string.
functionRemoves leading spaces from a string.
functionRemoves trailing spaces from a string.
functionConvert a string to all upper case characters.
specific position.
or 0 if the specified string cannot be found.
repeated as long as a specific string of characters (the search string) is
found within another string (the target string). After each iteration, the
target string contains all the data between occurrences of the search
string, excluding the search string. Once the loop is over, target contains
the remaining characters of the original data.
pattern.
56
Work with Characters
Name: Type:Description:
Char
Ord
functionReturns the character whose ASCII value is specified.
functionReturns the ASCII value of a character.
Work with Arrays and Color Arrays
Name: Type:Description:
Get
GetBlack
GetCyan
GetMagenta
functionReturns an element of an array.
functionReturns the value of the Black component of a color array.
functionReturns the value of the Cyan component of a color array.
functionReturns the value of the Magenta component of a color array.
Name: Type:Description:
GetYellow
Put
functionReturns the value of the Yellow component of a color array.
procedureAssigns a value to an element of an array.
Draw
Name: Type:Description:
Arc
ArcN
ClosePath
CRLF
CurveTo
RCurveTo
Fill
LineTo
RLineTo
procedureDraws an arc in a counter-clockwise direction. If there is a current point
set, the command draws a straight line from the current point to the
start point of the arc. Whether or not a current point is set when the
command executes, after execution the current point is the end point of
the arc.
procedureDraws an arc in a clockwise direction. If there is a current point set, the
command draws a straight line from the current point to the star t point
of the arc. Whether or not a current point is set when the command
executes, after execution the current point is the end point of the arc.
procedureCloses any open path and completes the current shape, if need be, by
drawing a line from the last point in the shape to the starting point. This
ensures the shape is closed, thus enabling filling to take place if
specified. Only closed shapes can be filled.
procedureMoves the current point by simulating a carriage return/line feed
combination. The horizontal position is reset to the value of the current
left margin, while the vertical position is offset by the leading value
specified.
procedureCreates a Bezier curve. Bezier curves are shapes defined using 4 points:
the starting and ending points are physical positioning points while the
second and third points are control points on the curve. In PlanetPress
Talk, the starting point is implicit and automatically set to the current
cursor position. The first control point defines the direction the curve
takes when moving from the starting point, and before shifting to the
second control point, which defines a second curve before reaching the
ending point.
procedureFills the current closed shape, using the colour specified with the
setfillcolor command. Only the inside of the shape is filled, not its
outline. To fill and outline the shape, use strokeandfill command
instead. If you only want to outline the shape, use stroke. Only closed
shapes can be filled.
procedureDraws a line starting from the current point up to the specified
coordinates.
57
3
PlanetPress Talk Summary
Name: Type:Description:
MoveTo
procedureMoves the current point to the specified coordinates.
RMoveTo
Pie
Rectangle
RectFill
RectFillStroke
RectStroke
Scale
SetAngle
SetDash
SetFillColor
SetLineWidth
SetStrokeColor
Stroke
procedureCreates a pie slice shape, which can then be rendered using stroke, fill,
procedureCreates and draws a rectangle shape. The rectangle can optionally be
procedureCreates and draws a filled rectangle shape. The colour used to fill the
procedureCreates a rectangle that has both an outline and a fill color. You set the
procedureCreates and draws an empty rectangle shape. The colour of the pen used
procedureScales the result of all commands that follow the scale() command.
procedureThis command rotates all subsequent commands by the angle specified.
procedureSet the properties of a dashed line. Any drawing done after setdash()
procedureSets the colour used to paint the insides of any closed shapes when
procedureSets the width of the pen used for drawing lines, boxes and other
procedureSets the colour of the pen used for drawing lines, boxes and other
procedureOutlines the current shape using the pen colour and width specified
or strokeandfill.
filled using the colour specified with the setfillcolor command. The
border can optionally be drawn using the colour specified with the
setstrokecolor command.
shape can be specified using the setfillcolor command.
color for the outline using setstrokecolor and the fill color using
setfillcolor.
to draw the rectangle can be set using setstrokecolor.
Most commands and objects that are displayed/printed on the
document are affected by the setangle command.
draws dashed instead of solid lines. You can revert to solid lines by
calling setdash() with an empty array as a parameter.
issuing a fill or a strokeandfill command.
objects. When setting the line width, remember that the exact location
of the pen is on the middle of the line, with the stroke spilling over
equally on both sides.
objects.
with the setstrokecolor and setlinewidth command. The shape is not
filled. To fill and outline the shape, use strokeandfill instead. If you only
want to fill the shape, use fill.
58
Name: Type:Description:
StrokeAndFill
procedureOutlines the current shape using the pen colour and width specified
with the setstrokecolor and setlinewidth command. The shape is then
filled using the colour specified with the setfillcolor command. To
simply outline the shape, use stroke instead. If you only want to fill the
shape, use fill.
Search
Name: Type:Description:
Find
Search
...
EndSearch
functionChecks for the presence of a string within a rectangular region of the
current data page. If the specified string is found, the function returns
true. This allows you to look for strings within a more general area,
rather than at some precise location.
procedureThis command structure allows a series of nested commands to be
repeated as long as a specific string of characters (the search string) is
found within another string (the target string). After each iteration, the
target string contains all the data between occurrences of the search
string, excluding the search string. Once the loop is over, target contains
the remaining characters of the original data.
Debug
Name: Type:Description:
Breakpoint
OutputDebugString
procedureStops the execution of a PlanetPress Talk object when the specified
expression is True. This breakpoint only happens when running the
document on your computer; it has no effect on the printed document.
It is used for debugging purposes.
procedureOutputs a string to the PlanetPress Talk Messages window in
PlanetPress.
59
3
PlanetPress Talk Summary
60
Language Reference
This section provides complete descriptions of all elements of the PlanetPress Talk scripting
Elements appear in alphabetical order, and each is illustrated with code samples you can try out in the
PlanetPress Design Talk Editor of the PlanetPress application.
Language Reference (Alphabetical)
Recall that the documentation convention for representing an optional argument to a command is to
enclose the argument in square brackets.
61
4
Language Reference
% (procedure)
Comments out the line. This is useful for embedding documentation in your code, making it easier to read
and maintain. It is also useful during debugging, for commenting out lines of code you do not want to
execute.
Note: Comments must not appear in the first line of the script you enter in the PlanetPress Talk Editor.
Syntax
% … comment ….
Argument
None
Code Sample Example
This example illustrates comments in PlanetPress Talk code.
Example
define(&x,integer,1)
%Creates a new local variable named x that is an
%integer and has a value of 1. The variable is used
%in a loop
for(&x,1,1,10)
show(inttostr(&x))
endfor()
62
@ (function)
Returns a selection within the current data page.
Syntax
@( line, startcolumn, endcolumn ) string value
Arguments
line — Integer value specifying the line on which to read the data in the current data page.
startcolumn, endcolumn — Integer values specifying the start/end columns of the chunk of data to read
from the current data page.
Code Sample Example
The first line of code assigns data from the current data page to a variable. The second line of code checks
for the presence of a value inside the data page and sets a Boolean variable according to the results.
Calls and executes a function or procedure created using the function() command.
Syntax
@name( parameters ) integer, measure, currency, string, Boolean or no return value
Arguments
name — String value specifying the name of the function or procedure.
parameters — List of parameters required by the specified function or procedure.
@page (procedure)
Executes the content of the specified document page, as if it were part of the calling page. The content of
the page in this case excludes the paper handling properties of the page. The height and width of the page
content thus becomes the height and width of the group that would result if you created a single group of
all of the page elements. If you want to include the paper handling properties in the page execution, see
$element (procedure).
The @page() and execpage() commands are equivalent.
Syntax
@page()
Arguments
page — String value specifying the name of the page you want to execute.
$element (procedure)
Executes the specified document element (object, page, resource, etc.). Note that in the case of a page, this
procedure executes both the content of the page and the paper handling properties of the page. The
height and width of the page are thus as set by the page size in the paper handling properties of the page.
63
4
Language Reference
Recall that every element in a document has a unique name. You can thus call any element in the
document at any time. For example, on the first page of a medical record document you might create a
header that contains all of the patient information, and on the other pages of the document, scale that
header to fit in the lower left corner of the page. Any modifications you subsequently make to the header
are automatically reflected throughout the document.
Syntax
$element
Arguments
element — String value specifying the name of the element you want to execute.
Code Sample Examples
Example 1 illustrates basic usage of the syntax. Example 2 scales the element $header to one quarter of its
original size, and rotates it 90 degrees. Example 3 creates a thumbnail of each of the first two pages and
positions the thumbnails side-by-side.
Example 1
$my_square
$page1
$box5
64
Example 2
scale( 0.25, 0.25 )
setangle( 90 )
$header
Example 3
scale( 0.10, 0.10 )
$page1
translate( 8.5, 0 )
$page2
+ (operator & function)
Either concatenates two or more strings or adds two numerical expressions, depending on its context.
This description details how to use it to concatenate two strings. See “Add (function)” on page 66 for help
using it to add two numerical expressions.
Syntax
string1 + string2 + ... string
Arguments
string1, string2,... — String values.
Code Sample Example
The following code sample concatenates five strings into a single string that contains the first and last
name of a customer.
See “Sub (function)” on page 159 and “Neg (function)” on page 118.
* (operator)
See “Mul (function)” on page 117.
/ (operator)
See “Div (function)” on page 87.
> (operator)
See “GT (function)” on page 104.
>= (operator)
See “GE (function)” on page 99.
< (operator)
See “LT (function)” on page 112.
65
4
Language Reference
<= (operator)
See “LT (function)” on page 112.
= (operator)
See “Eq (function)” on page 89
:= (operator)
Assign a value to a variable. This provides a more convenient alternative to the set() command. Note that
spaces between the operator and its operands are optional.
Code Samples
&price := 18.53
&day[4] := ‘Friday’
&last:=True
&mustard := [0,20,90,16] )
<> (operator)
See “NE (function)” on page 117
66
Add (function)
Adds two numerical expressions. This is the functional equivalent to the + operator, when you use the +
operator with numerical expressions.
Syntax
add( expression, expression2 ) integer, measure, currency value
Arguments
expression1, expression2 — Integer, measure, or currency values. Both expressions must be the same type.
The returned value is set according to the type of the parameters.
Code Sample Examples
Examples 1 and 2 show both ways of adding numbers.
Example 1
show(inttostr(2+2)) %Displays 4
Example 2
show(floattostr(add(4.7,2.1))) %Displays 6.8
And (Boolean operator function)
Returns true if both specified expressions are true, otherwise it is false.
Syntax
and( expression1, expression2 ) Boolean value
expression1 and expression2 Boolean value
Arguments
expression1, expression 2 — Boolean values.
Code Sample Examples
These examples illustrate the possible values for AND.
Example 1
and(true, false) %Returns false
Example 2
and(false, true) %Returns false
Example 3
and(false, false) %Returns false
Example 4
and(true, true) %Returns true
Arc (procedure)
Draws an arc in a counter-clockwise direction. If there is a current point set, the command draws a straight
line from the current point to the start point of the arc. Whether or not a current point is set when the
command executes, after execution the current point is the end point of the arc.
You define the arc you want to draw by specifying the x and y coordinates of the center of the circle, the
radius of the circle, and the start and end points for the arc. You specify each of the start and end points of
the arc as an angle; the command uses the angle to position the point. For example, to position the start
67
4
Language Reference
point, the command draws an invisible line at the specified start angle from the center of the circle, the
length of the radius; it positions the start point at the end of that line.
F
E
A
C
B
D
Example of an arc drawn from start point D to end point F: A. Center of circle (x,y) B. Radius C. Start angle D. Start point of arc
E. End angle F. End point of arc
Syntax
arc( x, y, arc_length, start_angle, end_angle )
68
Arguments
x, y — Measure values representing the x and y coordinates respectively of the center of the circle.
arc_length — Measure value representing the length of the arc.
start_angle — Measure value representing the start angle, in degrees, for the arc. Degrees are relative to a
standard X, Y axis, with a value of 0 degrees lying flush with the X axis. The value of the start angle can be
either positive or negative.
end_angle — Measure value representing the end angle, in degrees, for the arc. Degrees are relative to a
standard X, Y axis, with a value of 0 degrees lying flush with the X axis. The value of the end angle can be
either positive or negative.
Code Sample Examples
Example 1 draws a 180 degree arc 3 inches in length. The center of the circle is at (0,0). The rmoveto()
command that precedes the arc() command ensures the current point is set at the center of the circle and
prevents a line from being drawn from the current point to the start point of the arc.
Example 2 draws an arc 2.5 inches in length. The center for the arc is four inches from the left edge of the
page and three inches from the top edge. The arc starts at 30 degrees and ends at 60 degrees. The
rmoveto() command that precedes the arc() command moves the current point to the center of the circle,
resulting in a line that is drawn from the center of the circle to the start point of the arc.
Example 1
rmoveto(3,0)
arc(0,0,3,0,180)
stroke()
Example 2
rmoveto(4,3)
arc(4,3,2.5,30,60)
stroke()
ArcN (procedure)
Draws an arc in a clockwise direction. If there is a current point set, the command draws a straight line from
the current point to the start point of the arc. Whether or not a current point is set when the command
executes, after execution the current point is the end point of the arc.
You define the arc you want to draw by specifying the x and y coordinates of the center of the circle, the
radius of the circle, and the start and end points for the arc. You specify each of the start and end points of
the arc as an angle; the command uses the angle to position the point. For example, to position the start
point, the command draws an invisible line at the specified start angle from the center of the circle, the
length of the radius; it positions the start point at the end of that line.
D
B
C
A
E
F
Example of an arc drawn from start point D to end point F: A. Center of circle (x,y) B. Radius C. Start angle D. Start point of arc
E. End angle F. End point of arc
69
4
Language Reference
Syntax
arcn( x, y, arc_length, start_angle, end_angle )
Arguments
x, y — Measure values representing the x and y coordinates respectively of the center of the circle.
arc_length — Measure value representing the length of the arc.
start_angle — Measure value representing the start angle, in degrees, for the arc. Degrees are relative to
a standard X, Y axis, with a value of 0 degrees lying flush with the X axis. The value of the start angle can
be either positive or negative.
end_angle — Measure value representing the end angle, in degrees, for the arc. Degrees are relative to a
standard X, Y axis, with a value of 0 degrees lying flush with the X axis. The value of the end angle can be
either positive or negative.
BeginParagraph … EndParagraph (procedure)
Delimits a paragraph of formatted text.
The beginparagraph … endparagraph structure can contain only the following commands: setstyle(),
setstyleext(), show(), and % (indicating a commented line). Any other command included within this
structure will yield unpredictable results. A margin() command should precede the beginparagraph...endparagraph structure, and each variable you reference within the structure must
have its own procedure., as demonstrated in the second of the examples below. Also note that the first
command within a beginparagraph...endparagraph structure must be the setstyle() command.
No crlf procedures are permitted inside a paragraph structure, since crlfs are paragraph delimiters.
If you do not need to change fonts or use variables within a paragraph, it is strongly recommended you use
the text object in PlanetPress Design, as PlanetPress Design optimizes text objects to improve
performance.
When a long string containing no spaces between its characters appears in the context of a show()
command and the beginparagraph ... endparagraph() command, the line of text will not wrap. The
same is true for a text object; no wrapping occurs when a long string has no spaces between its characters.
Note that when a Text object is converted to PlanetPress Talk, an extra argument is is added to the
beginparagraph … endparagraph syntax. Ignore this argument since it is strictly for internal use.
70
Syntax
beginparagraph( lmargin, rmargin, firstindent, align, leading )
…
endparagraph()
Arguments
lmargin — Measure value specifying the left margin, in inches, of the text relative to the left border of the
object.
rmargin — Measure value specifying the right margin, in inches, of the text relative to the left border of the
object.
firstindent — Measure value specifying the indent, in inches, of the first line of the paragraph, relative to
the lmargin parameter.
align — String value specifying the text alignment within the paragraph. Possible values are 'left', 'right',
'center' and 'leftright' (for both left and right justification of text).
leading — Measure value specifying the amount of vertical space, in inches, between each line of the
paragraph.
Code Sample Examples
Example 1 displays a paragraph aligned to the right. Example 2 shows how to include a variable within a
formatted paragraph.
Example 1
beginparagraph(1,3,0,'right',0.16)
setstyle(&Default)
show('This long line of text should wrap around')
show('This long line of text should wrap around')
endparagraph()
Example 2
define(&var,string,'very')
beginparagraph(1,3,0,'left',0.16)
setstyle(&Default)
show('This ')
show(&var)
show(' long line of text should wrap around')
endparagraph()
BeginUTF8Paragraph … EndUTF8Paragraph (procedure)
Delimits a paragraph of formatted UTF8 text.
71
4
Language Reference
The beginUTF8paragraph … endUTF8paragraph structure can contain only the following commands: setstyle(), setstyleext(), showUTF8(), and % (indicating a commented line).
Note that the first command within a beginUTF8paragraph...endUTF8paragraph structure must be
either a setstyle() or a setstyleext() command. The style identified in either of these commands must be
associated with the True Type font type called ”TT host UTF8Arabic”.
Only UTF8 text can be displayed in a PlanetPress Talk object defined using the beginUTF8paragraph …
endUTF8paragraph structure. Non-UTF8 static text should therefore be converted to its UTF8 reference
using the Ansi/UTF8 Converter (place the cursor within the string and press CTRL+N). Variable text should
be converted using the mapUTF8 function.
No crlf procedures are permitted inside a paragraph structure, since crlfs are paragraph delimiters.
When a long string containing no spaces between its characters appears in the context of a show()
command and the beginUTF8paragraph ... endUTF8paragraph() command, the line of text will not
wrap.
Returns the width or height, in inches, of a bitmap image resource, at the specified resolution.
Syntax
Bitmapwidth( name, resolution ) measure value
Bitmapheight( name, resolution ) measure value
Argument
name — String value that specifies the name of the bitmap image resource.
resolution — Integer value that specifies the resolution at which you want to measure the width or height
of the bitmap.
Code Sample Example
This example sets the variable maxwidth to the width of the bitmap 'fingerprint' at a resolution of 150 DPI,
and the variable maxheight to the height of the same bitmap at a resolution of 200 DPI.
Example
&maxwidth := bitmapwidth( 'fingerprint', 150 )
&maxheight := bitmapheight( 'fingerprint', 200 )
73
4
Language Reference
Breakpoint (procedure)
Stops the execution of a PlanetPress Talk object when the specified expression is True. This breakpoint only
happens when running the document on your computer; it has no effect on the printed document. It is
used for debugging purposes.
Syntax
breakpoint( expression1 )
Argument
expression1 — Boolean value.
Code Sample Example
This example sets up a loop, stops the loop on its 5th iteration, and then displays the value.
Example
define(&x,integer,1)
for(&x,1,1,10)
breakpoint(&x = 5)
show(inttostr(&x))
endfor()
74
C128 (function)
Converts a two-character string to Code 128 bar code, character set C data.
Syntax
c128( string ) string value
Argument
string — String value composed of two characters.
Code Sample Example
This example converts the data on line 5, columns 12 to 13, to Code 128 bar code C character set data.
Example
c128(@(5,12,13))
CallPPD (procedure)
Calls a section of the PostScript Printer Description (PPD) file and executes it on the printer. Use this to set
printer options such as the input tray or duplexing options. The tokens and subtokens you use as
arguments with this function must be defined in the PPD file associated with your document or page in
the document’s or page’s Basic Attributes. PlanetPress Design searches the PPD file for the token-subtoken
combination and then prompts the printer to execute the corresponding code.
Syntax
callppd( token, subtoken )
Arguments
token—This is the string to search for in the PPD file (for example, Duplex).
subtoken—This is string to search for that is a setting for the token (for example, None).
Example
This example shows how you can use this function to achieve the same results you would using the
Advanced Paper Handling options. The first illustration shows duplex printing turned off using the
document’s Advanced Paper Handling options.
The following is an excerpt from the PPD file associated with the document.
*% Two-sided Printing (Duplex)
*OpenUI *Duplex/2-Sided Printing: PickOne
*OrderDependency: 50.0 AnySetup *Duplex
*DefaultDuplex: None
*Duplex None/Off: "
75
4
Language Reference
mark { (duplexmode) statusdict begin cvx exec end {
This next illustration shows how you can use the document’s PressTalk Before options to achieve the same
result.
76
As explained above, PlanetPress Design will search the PPD file for the combination “Duplex None”, which
could also be “Duplex Off” (line 5 of the PPD file excerpt above) and execute the corresponding code.
Char (function)
Returns the character whose ASCII value is specified.
Syntax
char( value ) string value
Argument
value — Integer value between 0 and 255, specifying the ASCII index of the character.
Code Sample Example
This example displays the word 'Talk'.
Example
show(char(84)+char(97)+char(108)+char(107))
Ceil (function)
Returns the smallest integer greater than or equal to the specified measure value.
Syntax
ceil( value ) integer value
Argument
value — Measure value. The absolute value of the measure value must be less than the maximum value of
an integer in PostScript (2,147,483,647).
Code Sample Examples
These examples illustrate various applications of ceil().
Example 1
ceil( -2.8 ) %Returns -2
Example 2
ceil( 2.8 ) %Returns 3
Example 3
ceil( -5.0 ) %Returns -5
77
4
Language Reference
ClearPage (procedure)
Clears the current data page. This command should only be used before reading the next page of data from
the input stream.
Syntax
clearpage()
Argument
None
ClosePath (procedure)
Closes any open path and completes the current shape, if need be, by drawing a line from the last point in
the shape to the starting point. This ensures the shape is closed, thus enabling filling to take place if
specified. Only closed shapes can be filled.
Syntax
closepath()
78
Argument
None
Code Sample Example
The first line of code sets the starting point of a triangle, the second and third lines of code draw the first
and second lines (or sides) of the triangle, the fourth line of code closes the triangle shape by implicitly
issuing a moveto command.
Example
moveto(1.0,1.0)
lineto(1.5,2.0)
lineto(0.5,2.0)
closepath()
fill()
Cos (function)
Returns the cosine value of the specified angle.
Syntax
cos( value ) measure value
Argument
value — Measure value specifying the angle whose cosine is returned.
Moves the current point by simulating a carriage return/line feed combination. The horizontal position is
reset to the value of the current left margin, while the vertical position is offset by the leading value
specified.
Syntax
crlf( [leading] )
Argument
leading — Measure value setting the vertical distance, in inches, between two lines. If you do not provide
this argument, the value by default is 0.167 inches, which is roughly equivalent to a 6 LPI (lines per inch)
setting.
Code Sample Example
This example demonstrates how to change the vertical spacing of lines within an object.
Example
margin(1,1)
show('These lines are displayed')
79
4
Language Reference
crlf(0.125)
show('at 8 LPI.')
crlf(0.5)
show('While these lines are displayed')
crlf(0.5)
show('at 2 LPI')
Current (system object)
This object includes a set of system variables reflecting the current state of the document. All of these
variables are read-only and therefore cannot be changed using the set command, except where noted. You
can access each property individually using the same syntax.
Syntax
¤t.property integer, measure value
Properties
datapage — Integer value containing the page number of the current data page, or the number of the
current record set in the case of a database emulation.
line — Integer value containing the line number of the current line of data within the data page, or the
number of the current record within the record set. This value is read-write and can be modified using the
set command.
lpp — Integer value containing the number of lines per page in the current data page. In database
emulation, this value can also be used in place of the subreccount() function to determine how many
records a record set contains.
mediacolor — String value containing the color set in the Media color box of the Page dialog box for the
current document page, or, if no value is set in that box, the color set in the Media color box in the
Document dialog box for the document. The Media color box appears when you select Media selection in
the Selection type box. Recall that the Media color box specifies the color of paper.
mediatype — String value containing the type set in the Media type box of the Page dialog box for the
current document page, or, if no value is set in that box, the type set in the Media type box in the Document
dialog box for the document. The Media type box appears when you select Media selection in the Selection
type box. Recall that the Media type box specifies the type of paper (plain, coated, etc.).
mediaweight — Integer value containing the weight set in the Media weight box of the Page dialog box for
the current document page, or, if no value is set in that box, the weight set in the Media weight box in the
Document dialog box for the document. The Media weight box appears when you select Media selection
in the Selection type box. Recall that the Media weight box specifies the weight of paper, in grams per
square meter.
80
minfeature —
Measure value containing the width of a single pixel at the current zoom level. Precise to 1/
65536 inch. This is the minimum size you can use in PlanetPress Talk code. If you use a smaller value (for
example as an argument in a command), PlanetPress Talk automatically replaces that value with the value
of minfeature.
orientation — Integer value containing the orientation of the current document page (0=portrait,
overflowcount — Integer variable storing the number of times that a data page overflowed and that a new
document page was added to accommodate the overflowing data. Initially set to 0, is incremented by 1
every time the page overflows.
overflowing — Boolean variable set to False by default. When the current data page contains more lines
than can be printed by the current object, or technically speaking when the object’s condition to exit and
overflow has been met, this variable is set to True. It is set back to False with every new overflowing page,
the logic being that the current overflowing page will be the last, unless if the condition to exit and
overflow is met yet again.
lastoverflowrepetition — Integer variable storing the number of the last iteration value when the condition
to exit and overflow has been met.
pageheight — Measure value containing the physical page height, in inches, of the current page in the
document.
pagename — String value containing the name of the page that is actually printing. This allows
conditional processing to take place within a PPTalk object according to the name of the page being
executed. Note that the value always corresponds to the name of the actual document page being printed,
even if the call comes from a virtual or overlay page (in other words, the name of the page on which the
overlay is layed out).
pagewidth — Measure value containing the physical page width, in inches, of the current page in the
document.
printpage — Integer value containing the current page number in the document.
x,y — Measure value containing the current horizontal (x) or vertical (y) position of the drawing pen on
the current page. This value is relative to the top left corner of the current page - whose coordinates are
(0,0) - and may not necessarily be equal to the current physical position on the page.
currentiteration (variable)
Variable storing the number of times that a line was repeated within an object or group. Initially set to 0
in every object, it is incremented by 1 with every line repeat. It can also be used to track repetitions within
a group of objects.
Syntax
¤titeration (when used as a local variable)
81
4
Language Reference
&[GroupName].currentiteration (when used to keep track of repetitions within a group)
CurToStr (function)
Converts a currency expression into a string value.
Syntax
curtostr( expression ) string value
Argument
expression — Currency value to convert.
CurveTo/RCurveTo (procedure)
Creates a Bezier curve. Bezier curves are shapes defined using 4 points: the starting and ending points are
physical positioning points while the second and third points are control points on the curve. In
PlanetPress Talk, the starting point is implicit and automatically set to the current cursor position. The first
control point defines the direction the curve takes when moving from the starting point, and before
shifting to the second control point, which defines a second curve before reaching the ending point.
A complete explanation of Bezier curves is beyond the scope of this document. Feel free, however, to try
out this command using the PlanetPress Talk Editor in PlanetPress Design in order to study its possibilities.
82
Note: To draw a simple curve, use the same (x,y) coordinates for both control points.
Syntax
curveto( x1, y1, x2, y2, x3, y3 )
Arguments
x1, y1, x2, y2, x3, y3 — Pairs of measure values representing the horizontal/vertical position, in inches, of
each point defining the Bezier curve. When using rcurveto, these values are relative to the current point of
origin. When using curveto, they are absolute values.
Code Sample Example
This example draws a triangle with a twisted bottom side. The triangle has a blue outline and is filled with
yellow.
Example
setstrokecolor([100,100,0,0])
setfillcolor([0,0,100,0])
moveto(1,1)
lineto(1.5,2)
curveto(1,1,1,3,0.5,2)
closepath()
strokeandfill()
Date (function)
Returns the print date. Note that this function will only work if the document runs on a computer, since it is
impossible for the document to get the current date from a printer. So if you send your document to a
printer and then simply send data with the appropriate trigger to that printer, the document will run on
the printer and the function will return an empty string. Use the Run locally option, available in
PlanetPress Watch, to ensure that the document runs on a computer rather than on a printer.
Syntax
date(longdate)
Argument
longdate — Boolean specifying whether to use short or long date. True returns the date in long format,
False, in short format. The precise format of the short and long date value strings are set in the Windows
Regional options.
Code Sample Example
This example shows how to add the current date in long form on a document page.
Example
show(date(true))
Define (procedure)
This command creates a new local variable, or redefines an existing one. The define procedure must appear
before the variable is actually used. It is considered good practice to define all your variables at the top of
your program.
Syntax
define( name, type, value )
83
4
Language Reference
Arguments
name — The name of the variable, prefixed with the ampersand (&) character. The name must conform to
the rules for names described in “Names” on page 7.
type — Constant value specifying the variable type, either integer, measure, string, Boolean, or an array
type. The array types are color, arrayinteger, arraymeasure, arraycurrency, arrayBoolean, arraystring or
directory. Once a type is assigned to a variable, it cannot be changed, unless the variable is redefined.
value — An initial value for the variable, of the same type as the variable (for example if the variable is of
type integer, this value must be an integer). This value can also be a valid PlanetPress Talk expression. In
the case of any array variable other than a color array or an array of type directory, the initial value can be
either the number of elements you want the array to contain, or the set of values you want the array to
contain. In the former case you assign values to the array elements in subsequent commands. In the latter
case, you separate each value by a comma, and enclose the complete set of elements in square brackets.
In the case of a string array, you must also quote each of the array elements. In an array of type directory,
you specify the pathname to the folder and the file name filter you want to apply to each of the files in that
folder; this in turn determines the number of elements in the array.
Specifies the data file to use for data selections.
Syntax
definedata( path )
Argument
path — String value specifying the path of the data file.
DefineImageIndex (procedure)
Defines a PlanetPress Search index term. PlanetPress Image uses this information to generate the .PDI file
it creates for each PDF file it creates. You use SetImageIndex() to associate a data value with the index
term.
Syntax
defineimageindex( name[, length] )
Arguments
name — String value specifying a name for the index term.
length — String value specifying a length for the index term.
Code Sample Examples
Example1 defines the index term 'PONumber' and assigns it a length of 8 characters. The PDI file generated
by PlanetPress Image contains the line: ~IndexName=PONumber,8. Example 2 defines the same index
term, this time without defining a length for the term. In this case the line in the PDI file becomes:
~IndexName=PONumber
Example 1
defineimageindex( 'PONumber', '8')
Example 2
defineimageindex( 'PONumber' )
Directory
The directory type is a type of string array in which each element in the array contains a pathname. All
pathnames in the array reference a file in the same folder. The number of elements in the array, and the
initial value of each element are both determined dynamically at the time the array is created. You specify
the folder, and the filter you want to apply to the list of files in that folder. When PlanetPress Talk creates
the array, it locates the folder you specified, applies the filter to the list of files that folder contains, and
then for each file that meets the filter criteria, adds its pathname to the directory array. Pathnames may
be either printer pathnames or host pathnames.
You can subsequently set the value of any of the elements in the array, as you would for any element in an
array of type string.
Code Sample Example 1
Example 1 uses a directory on the root drive of a printer.
85
4
Language Reference
Example 1
define(&MyVar, directory, '*') %root of the printer
Code Sample Example 2
Example 2 defines a directory array in which each element in the array contains a pathname to an image
in EPS format in the folder c:\images.
Example 3 prints a list of all of the pathnames in that array.
Example 3
define( &i, integer, 0 )
for( &i, 0, 1, length( &image_paths ) - 1 )
show( &image_paths[&i] )
crlf( 0.16 )
endfor()
86
Code Sample Example 4
Example 4 displays each of the images referenced by the array, at a resolution of 100 pixels per inch, scaled
to a 'best fit' with a one-inch by one-inch rectangle.
Example 4
for( &i, 0, 1, length( &image_paths ) - 1 )
showbitmap( &image_paths[&i], 100, 1, 1 )
crlf( epsheight( &image_paths[&i] ) )
endfor()
Code Sample Example 5
Example 5 prints either an image, or, if the image cannot be found, the pathname to the image.
Example 5
define( &i, integer, 1 )
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.