PlanetPress Talk Reference Guide
Copyright Information Copyright © 1994-2007 Objectif Lune Inc. All Rights Reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any other language or computer language in whole or in part, in any form or by any means, whether it be electronic, mechanical, magnetic, optical, manual or otherwise, without prior written consent of Objectif Lune Inc. Objectif Lune Inc.
OBJECTIF LUNE PLANETPRESS SUITE 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’s and its suppliers’ liability and the exclusive remedy shall be, at Objectif Lune’s sole 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.
Table of Contents 1 PlanetPress Talk Basics 1 Key Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Assumed Knowledge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 PlanetPress Talk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
toc Debugging Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Code Execution in the Editor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Detailed Directions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Work with Global Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Define and Assign Values to Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Work with Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
toc CallPPD (procedure). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Char (function) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Ceil (function). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
&Height (system variable) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 If (function). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 If … ElseIf… EndIf (procedure) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
toc Repeat... Until (procedure) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 ResourceType (function) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Right (function) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
StrokeAndFill (procedure). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 StrToCur (function) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 StrToFloat (function) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
toc viii
PlanetPress Talk Basics PlanetPress Talk is a complete scripting language that opens the door to more powerful and sophisticated documents. Summary Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Key Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Detailed Directions . . . . . . .
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
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.
1 PlanetPress Talk Basics Command: setstyle(&Default) margin(0,0.167) rmoveto(stringwidth(' rmoveto(neg(stringwidth(' Tells the document to: 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. '),0) 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 Elements of PlanetPress Talk 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: Variables A variable is a value that changes over time. See “Variables” on page 13. System objects An object is a set of related system variables.
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.
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.
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.
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.
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'. String Length, in characters Maximum on screen 2147483647 Maximum PostScript 65535 Booleans Booleans have a value of either True or False. Every condition you define in PlanetPress Design resolves to a Boolean value.
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.
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 2 define( &image_paths, directory, 'c:\\images\\*.EPS' ) Code Sample Example 3 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.
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. Type The type of a variable defines what kind of data it contains and consequently what kinds of operations you can perform on it.
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.
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.
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 B A. A PlanetPress Talk object created without defining a UTF8 paragraph ; B.
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.
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.
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.
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.
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.
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.
Code Samples 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.
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: &second Type: Initialized to: Description: Boolean False The emulation uses this to determine when the current line is a second line of data.
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.
1 PlanetPress Talk Basics translate(neg(8.5),1.75) endfor() % ======================================================= % DOCPAGE CODE: CREATE THE DATA SELECTION % ======================================================= moveto(0,0) margin(0.1,0) setstyle(&header) show('Supplier district:'+ @(&six,1,30))crlf(0.166) Notes • In the runpage code, the outermost for loop loops six times, and positions the copy of the page in one of the six rows.
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.
1 PlanetPress Talk Basics 28
PlanetPress Talk Editor 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.
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
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.
2 PlanetPress Talk Editor Feature: Description: Syntax highlighting You 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.
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.
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.
Detailed Directions The code you enter in the PlanetPress Talk before property of the element. 2 Element 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.
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. 2 In 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.
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.
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 B C A.
Detailed Directions When you are entering commands, remember that PlanetPress Talk is case-insensitive. To enter commands: • 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.
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.
PlanetPress Talk Summary This section provides a summary of all elements in the PlanetPress Talk scripting language. Summary Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Operators and Operator Functions . . . . . . . . . . . .
3 PlanetPress Talk Summary • System Objects with Global Scope System Variables with Local Scope Name: &Height &Width Description: 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.
Name: &Current.LPP Description: 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.
3 PlanetPress Talk Summary Physical System Object Name: &Physical.x &Physical.y Description: Measure value containing the current horizontal (x) or vertical (y) position of the drawing pen, relative to the upper left corner of the physical page, whose coordinates are (0,0). This system object can be used to assess the amount of space left on a page. System System Object Name: &System.Product Description: String value containing the name of the RIP the document is using to execute. For example, &System.
Name: – Sub * Mul / Div Mod Type: Description: operator function Subtracts one expression from another. This is the functional equivalent of the - operator. operator function Multiplies two expressions. This is the functional equivalent of the * operator. operator function Divides an expression with another. This is the functional equivalent to the / operator. function & Returns the remainder resulting from the division of two numbers.
3 PlanetPress Talk Summary Name: Or XOr Type: Description: logical Returns true if either or both specified expressions are true, false operator & otherwise. function logical Returns true if only one of two specified expressions is true, false operator & otherwise. function Comparison Operators and Operator Functions Name: >= GE Type: Description: operator function Compares two expressions of any type and returns true if the first is greater than or equal to the second, false otherwise.
Name: StrToCur StrToFloat StrToInt Type: Description: function Converts a string value into a currency value. function Converts a string into a measure value. function Converts a string into an integer value. Type: Description: 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.
3 PlanetPress Talk Summary Loop and Condition Structures Loop Structures Name: For ... EndFor Type: Description: procedure This command structure allows a series of nested commands to be 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. Repeat ... Until procedure Repeat a sequence of commands until a condition is true. It is similar to a for...
Commands Add a Comment Name: % Type: Description: 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. Work with Emulations Name: SetEmulation SetLPP Type: Description: procedure Sets the emulation to use.
3 PlanetPress Talk Summary Work with Database Records Name: Field Type: Description: function Returns the contents of the specified field for the current record. This function is only useful in database emulation mode. FieldCount function Returns a count of fields in the current database record. Since all records 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.
Name: SetPDFBookmark Type: Description: procedure Creates a PDF bookmark at the current page, for the PDF files PlanetPress Image generates. Execute Documents and Document Elements Name: @page Type: Description: 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.
3 PlanetPress Talk Summary Work with PPDs Name: CallPPD Type: Description: 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.
Name: Function Type: Description: procedure Defines 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.
3 PlanetPress Talk Summary Work with Images and Attachments Name: BitmapWidth BitmapHeight EPSWidth EPSHeight InStream... EndInStream PDFWidth PDFHeight PDFPageCount PixelHeight PixelWidth ShowBitmap ShowEPS ShowPDF ResourceType Type: Description: function Returns the width or height, in inches, of a bitmap image resource, at the specified resolution. function Returns the width or height, in inches, of an Encapsulated PostScript (EPS) image resource.
Name: Margin Type: Description: procedure Offsets 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. Show ShowCenter ShowRight procedure These three commands are used to display simple text on the document.
3 PlanetPress Talk Summary Name: Mid Type: Description: function Extracts a specified number of characters from a string, starting at a specific position. Pos function Returns the starting position of a specified string within another string, or 0 if the specified string cannot be found. Right Search ... EndSearch function Extracts the specified rightmost characters of a string.
Name: GetYellow Put Type: Description: function Returns the value of the Yellow component of a color array. procedure Assigns a value to an element of an array. Draw Name: Arc Type: Description: 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.
3 PlanetPress Talk Summary Name: MoveTo RMoveTo Pie 58 Type: Description: procedure Moves the current point to the specified coordinates. procedure Creates a pie slice shape, which can then be rendered using stroke, fill, or strokeandfill. Rectangle procedure Creates and draws a rectangle shape. The rectangle can optionally be filled using the colour specified with the setfillcolor command. The border can optionally be drawn using the colour specified with the setstrokecolor command.
Name: StrokeAndFill Type: Description: procedure Outlines 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. Type: Description: function Checks for the presence of a string within a rectangular region of the current data page.
3 PlanetPress Talk Summary 60
Language Reference This section provides complete descriptions of all elements of the PlanetPress Talk scripting language. Summary Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Language Reference (Alphabetical) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
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.
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. Example define(&invnum,string,@(7,50,59)) define(&isfirstpage,boolean,(strtoint(@(1,60,70))=1)) @name (function/procedure) Calls and executes a function or procedure created using the function() command.
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.
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.
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 Add (function) Adds two numerical expressions.
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.
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.
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.
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.
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.
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”.
Example setlinewidth(0.007) moveto(0,0) rlineto(&width,0) rlineto(0,&height) rlineto(neg(&width),0) rlineto(0,neg(&height)) closepath() stroke() moveto(&width/2,&height/18) BeginUTF8Paragraph(0.0000,&width,0.0000,'leftright',0.1667,'rtl') SetStyleExt(&Style1,12.0000,0,[100],100) ShowUTF8('\u0623\u0633\u0627\u0633\u064B\u0627\u060C') EndUTF8Paragraph() BitmapWidth/BitmapHeight (function) Returns the width or height, in inches, of a bitmap image resource, at the specified resolution.
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.
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.
4 Language Reference mark { (duplexmode) statusdict begin cvx exec end { <> setpagedevice {}if cleartomark" }if } stopped *End *Duplex DuplexNoTumble/Long-Edge Binding: " mark { (duplexmode) statusdict begin cvx exec end not (tumble) statusdict begin cvx exec end or { <> setpagedevice }if } stopped {}if cleartomark" *End This next illustration shows how you can use the document’s PressTalk Before options to achieve the same result.
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.
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 cos( value ) measure value Argument value — Measure value specifying the angle whose cosine is returned. Code Sample Example This example displays a sinusoidal graph. Example moveto(0,0) define(&i,integer,0) for(&i,1,10,360) lineto(cos(inttofloat((&i)/ 4)),sin(inttofloat(&i))) endfor() closepath() CRLF (procedure) Moves the current point by simulating a carriage return/line feed combination.
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.
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, 1=landscape, 2=Rotated portrait, 3=Rotated landscape).
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.
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.
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.
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.
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 2 define(&image_paths, directory, 'c:\\images\\*.EPS' ) Code Sample Example 3 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.
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() Div (function) Divides an expression with another. This is the functional equivalent to the / operator. Syntax div( expression, expression2 ) integer, measure, currency value Arguments expression1, expression2 — Integer, measure or currency values. Both expressions must be the same type.
4 Language Reference Code Sample Example This example is an extract from a user-defined emulation. The search() command looks for a formfeed and adds its line number. The line number is stored as a string and the document is run. The data page is cleared and the search is over. Example search(&str,'\014') set(¤t.line,¤t.line + 1) store(¤t.
Code Sample Example This example sets the variable maxwidth to the width, and the variable maxheight to the height of the EPS image resource wing_nut. Example &maxwidth := EPSwidth( ‘wing_nut’ ) &maxheight := EPSheight( ‘wing_nut’ ) Eq (function) Compares two expressions of any type and returns true if both are equal, false otherwise. This is the functional equivalent of the = operator. Syntax eq( expression1, expression2 ) boolean value Arguments expression1, expression2 — Values of any type.
4 Language Reference Syntax execpage( pagename ) Argument pagename — String value specifying the name of the page to run. The page must exist, and its name is case insensitive. Code Sample Example In this example, the current page executes pages 2, 3 or 4 according to a data selection. This allows you to create pages of 'subroutines' that can be called from any other page.
for(&x,1,1,¤t.lpp) if(pos('Invoice',@(&x,1,80))>0) exit() endif endfor() Field (function) Returns the contents of the specified field for the current record. This function is only useful in database emulation mode. Syntax field( fieldname[, recordnumber] ) string value Argument fieldname — String value specifying the name of the field whose value you want to retrieve. recordnumber — Integer value specifying the number of the record, in the current record set, whose value you want to retrieve.
4 Language Reference FieldCount (function) Returns a count of fields in the current database record. Since all records 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. Syntax fieldcount() integer value Code Sample Example See “Field (function)” on page 91. FieldName (function) Returns the name of the specified field for the current record.
Code Sample Example This example draws a yellow filled triangle. Example setfillcolor([0,0,100,0]) moveto(1,1) lineto(1.5,2) lineto(0,2) closepath() fill() Find (function) Checks 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.
4 Language Reference &FirstSide (system variable) 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. This variable is based on PostScript’s firstside command as implemented in your printer. If your printer does not support firstside, the document attempts to detect which side of the page is currently printing.
Argument expression — Measure value to be converted. precision — The number of decimal places to include in the result string. Code Sample Examples These examples illustrate floattostr(). Example 1 floattostr(3.14) %Returns 3.14 Example 2 floattostr(11) %Returns 11.0 Example 3 floattostr(34.6453455, 4) %Returns 34.6453 For… EndFor (procedure) This command structure allows a series of nested commands to be repeated a specified number of times.
4 Language Reference startvalue — Integer value to initialize varname. increment — Integer value used to increment varname after each iteration. stopvalue — Integer value after which iterations stop. Code Sample Example This example simply prints 5 lines of text. Note: To cycle backwards through values, make startvalue larger than stopvalue, and specify a negative increment.
function @name( arglist ) ... endfunction() Arguments name — Name to use for the function, prefixed with the @ character. The name must conform to the rules for names described in “Names” on page 7. It is good practice to be careful naming functions that you define in different documents, to ensure that if at some point you want to copy code between documents, the names of functions do not conflict.
4 Language Reference %==================================================== %Local variables %==================================================== define(&SB,measure,0) define(&EB,measure,0) define(&Scaling,measure,0) define(&R,measure,&W/2) %==================================================== &Scaling := (&H-&HB)/&W gsave() if(&Scaling<0.01) &Scaling := 0.
rlineto(0,&HB) arc(0,&HB,&R,&SB,&EB) rlineto(0,neg(&HB)) closepath() strokeandfill() endif() %==================================================== setfillcolor(&c) pie(0,0,&R,&S,&E) strokeandfill() &SB := (&S+&E)/2 %==================================================== if(gt(&SB,180)) margin(cos(&SB) * &R,neg(sin(&SB) * &R)+&HB+(0.2/&Scaling)) elseif() margin(cos(&SB) * &R,neg(sin(&SB) * &R)-(0.
4 Language Reference Code Sample Examples Example 1 and Example 2 show both ways of comparing two expressions. Example 2 illustrates the >= operator. Example 1 if( ge(¤t.line, 50) ) show('Bottom of page') endif() Example 2 if(¤t.line >= 50) show('Bottom of page') endif() Get (function) Returns an element of an array. Syntax get( array, position ) array element Argument array — Name of the array. position — Integer specifying the position in the array, of the element you want to retrieve.
Syntax getblack( color ) integer Arguments color — Color array for which you want to determine the Black value. Code Sample Example setfillcolor([getcyan(&c),getmagenta(&c),getyellow(&c),if(getblack(&c)>50,100, getblack(&c)+20)]) GetCyan (function) Returns the value of the Cyan component of a color array. Syntax getcyan( color ) integer Arguments color — Color array for which you want to determine the Cyan value.
4 Language Reference GetNextDataPage(procedure) Advance 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. Syntax getnextdatapage() GetYellow (function) Returns the value of the Yellow component of a color array. Syntax getyellow( color ) integer Arguments color — Color array for which you want to determine the Yellow value.
GSave (procedure) This 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.
4 Language Reference GT (function) 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. Syntax gt( expression1, expression2 ) Boolean value Arguments expression1, expression2 — Values of any type. Both expressions must be of the same type. Code Sample Examples Examples 1 and 2 illustrate both ways of comparing two expressions. Example 1 if( gt(¤t.
Arguments expression — Boolean value. If it evaluates to true, the function returns the contents of trueresult, otherwise it returns the contents of falseresult. trueresult, falseresult — Values of any type, as long as both are of the same type. The return value of the function is therefore of the same type as trueresult and falseresult. Code Sample Example This example changes the text to display according to the current value of a variable.
4 Language Reference %If &x is an even number setstyle(&bluefont) %use the blue font elseif() %otherwise setstyle(&Default) %use the default font endif() show('Some text to display') %Display the text crlf() %Skip to the next line endfor() IntToFloat (function) Converts an integer expression into a measure value. Syntax inttofloat( expression ) measure value Argument expression — Integer value to be converted. Code Sample Example This example uses a loop to draw a series of blue rectangles.
endfor() IntToStr (function) Converts an integer expression into a string value. Syntax inttostr( expression ) string value Argument expression — Integer value to be converted. Code Sample Example This example prints the iterations of a loop. Example define(&x,integer,1) %Define loop variable for(&x,1,1,10) %Set up loop show('Iteration ' + inttostr(&x) ) %Show text crlf() %Skip line endfor() InStream... EndInStream (procedure) Ceate an alias for a resource file (image, data file, attachment, etc.).
4 Language Reference path endinstream() If you want to create a reference to a text document (for example a sample data file), replace "external" by "cleartext.” Argument resname — String value specifying the alias to use to refer to this resource file. path — String value specifying the path of the resource file. Code Sample Example This example creates the alias 'photo' that refers to the resource file c:\images\employees\JAdler.bmp. Example instream external photo c:\images\employees\JAdler.
IsPageEmpty (function) Returns False if the current data page contains data, or True if it does not. Syntax ispageempty() Boolean iterationcount (variable) Integer variable local to the current object that is incremented each time the iteration is executed (when the iteration condition is True.) LE (function) Compares two expressions of any type and returns true if the first is less than or equal to the second, false otherwise. This is the functional equivalent to the <= operator.
4 Language Reference Syntax left( string, number ) string value Arguments string — String value from which to extract characters. number — Integer value specifying how many characters to extract from the beginning of the string. Code Sample Example This example prints a string up to a certain position.
Example 2 define(&data,string,'This is a~sample string') define(&x,integer, pos('~', &data)) %Find tilde if(&x>1) show(right(&data,length(&data)-&x)) %Show remainder of string endif() LineTo/RLineTo (procedure) Draws a line starting from the current point up to the specified coordinates. Syntax lineto( x, y ) Arguments x, y — Measure values representing the horizontal/vertical position, in inches, of the ending point of the line.
4 Language Reference Syntax lowercase( string ) string Argument string — String value you want to convert to lower case. The string may be a mix of upper and lower case characters. Code Sample Example &partname := lowercase( @(30,16,39) ) LT (function) 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.
Syntax maputf8( text, encoding, reversedmapping ) Arguments text — Static text string or data selection to be converted. encoding — String identifying the original encoding or reference to a style defined in the document that identifies the original encoding. reversedmapping — Boolean specifying whether the text to be converted should be mapped in regular or reversed order. Possible values are true (reversed mapping) and false (no reversed mapping).
4 Language Reference Example 2 setlinewidth(0.007) moveto(0,0) rlineto(&width,0) rlineto(0,&height) rlineto(neg(&width),0) rlineto(0,neg(&height)) closepath() stroke() moveto(&width/2,&height/2) SetStyleExt(&Style1,12.0000,0,[100],100) showUTF8right(maputf8(@(2,15,35), &MyArabEncoding, False),'normal') Margin (procedure) Offsets 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.
Mid (function) Extracts a specified number of characters from a string, starting at a specific position. Syntax mid( string, start, length ) string value Arguments string — String value from which to extract characters. start — Integer value specifying where the first character to extract is located. length — Integer value specifying how many characters to extract, starting from number onwards. Code Sample Example This example extracts a bracket-delimited word from a sentence.
4 Language Reference number2 — Integer value with which to divide number1. Code Sample Example This example uses MOD to distinguish between odd and even numbers. Example define(&i,integer, 1) %Define loop variable for(&i,1,1,10) %Set loop show(inttostr(&i)+' is an') %Display number if(mod(&i,2)=1) %Determine if number is odd or even show(' odd ') elseif() show(' even ') endif() show('number.') crlf() endfor() MoveTo/RMoveTo (procedure) Moves the current point to the specified coordinates.
lineto(1.5,2) %Draw first line lineto(0.5,2) %Draw second line closepath() %Close shape stroke() %Draw shape Mul (function) Multiplies two expressions. This is the functional equivalent of the * operator. Syntax mul( expression, expression2 ) integer, measure, currency value Arguments expression1, expression2 — Integer, measure or currency values. Both expressions must be of the same type. The returned value is set accordingly to the type of the parameters.
4 Language Reference Example 1 if( ne(¤t.line, 1) ) show('Not a new page') endif() Example 2 if(¤t.line <> 1) %Same statement, using the <> operator show('Not a new page') endif() Neg (function) Returns the negative value of the specified expression. This is the functional equivalent to the - sign. Syntax neg( expression1 ) integer, measure, currency value Argument expression1 — Integer, measure or currency value. The returned value is the same type as expression1.
Argument expression1 — Boolean value. Code Sample Example This example shows how NOT can be used in place of operators. Example define(&x,integer,1) %Define loop variable for(&x,1,1,10) %Set loop if(not(&x=5)) %Same as if(&x<>5) show('This is NOT the 5th line') %Show some text elseif() show('This IS the 5th line') %Show alternate endif() endfor() Object $name()... EndObject (procedure) Creates an object. You can reference the object you create using the $ operator.
4 Language Reference Argument name — Name to use for the object, preceded by the dollar sign character ($). The name must conform to the rules for names described in “Names” on page 7. top — Measure value specifying the distance, in inches, to offset the top edge of the picture object, from the top edge of the document page. If you set the snaptoprevious argument to a value other than 0, the value you set for the top argument becomes the vertical offset for the Snap to previous snapping point.
LineTo(&width,&height) LineTo(0.0,&height) LineTo(0.0,0.0) ClosePath() Stroke() endobject() Or (Boolean operator function) Returns true if either or both specified expressions are true, false otherwise. Syntax or( expression1, expression2 ) Boolean value expression1 or expression2 Boolean value Arguments expression1, expression2 — Boolean values. Code Sample Examples These examples illustrate the possible values for OR.
4 Language Reference Syntax ord( string ) integer value Argument string — String value whose ASCII value is returned. Only the first character is considered. Code Sample Example This example shows how to determine if a character is lowercase or uppercase.
Syntax passthrough( string ) Argument string — String value to be sent to the printer. This string is sent as is, with no further modification. Code Sample Example Refer to your PostScript manual for valid commands. PDFPageCount (function) Returns the number of pages in the specified PDF file. Syntax pdfpagecount( filename ) integer Argument filename — String value specifying the path of the PDF file.
4 Language Reference &maxheight := pdfheight( ‘parts_manual’,4 ) Physical (system object) The physical object contains system variables that reflect the current state of the document. These system variables are read-only and therefore cannot be changed using the set command. You can access each system variable using the same syntax. Syntax &physical.x &physical.
pie(1.5,1.5,1,290,420) %Create shadow for second slice fill() %Display shadows translate(-0.3, 0.3) %Offset chart from its shadow setstrokecolor([0,0,100,0]) %Set pen colour to yellow setfillcolor([0,100,100,0]) %Set fill colour to red pie(1.5,1.5,1,60,290) %Create first slice strokeandfill() %Draw first slice translate(0.2,0.2) %Separate slices setfillcolor([100,100,0,0]) %Set fill colour to blue pie(1.5,1.
4 Language Reference Syntax pos( string1, string2 ) integer value Arguments string1 — String value to search for. string2 — String value in which to search. Code Sample Example This example uses POS to look for a word in a data selection. Example define(&s,string,@(1,40,10)) %Initialize var.
Possible Values Value: Description: 0 PlanetPress Design during document design 1 Screen Preview 2 Screen Preview for PlanetPress Image 3 Screen Preview for PlanetPress Fax 4 Printer Preview 5 Printer Hard Disk 6 Printer Memory 7 Host Computer 8 Flash Memory 9 PlanetPress Image 10 PlanetPress Fax 11 PlanetPress Watch Code Sample Example This example changes some colurs to shades of gray for greater legibility on a fax. Example setlinewidth(0.
4 Language Reference Syntax put( &array, index, value ) Arguments &array — Array variable containing the element whose value you want to change. index — Integer value representing the position of the element in the array. value — The value you want to assign to the element. The value must be of the same the type as the array. Thus if the array is of type string, the value must be of type string. Random (function) Returns a measure value between 0 and 1, non-inclusive.
Syntax rectangle( x, y, x1, y1, filled, stroked ) Arguments x, y — Measure values representing the horizontal/vertical position, in inches, of the starting point. x1, y1 — Measure values representing the horizontal/vertical position, in inches, of the bottom right corner of the rectangle. filled — Boolean value specifying whether the shape should be filled using the colour specified with the setfillcolor command.
4 Language Reference Example setfillcolor([0,100,100,0]) %Draw first rectangle using rectfill with red rectfill(1,1,2,2) %Offset starting position slightly to distinguish %between each rectangle and fill second one with blue. translate(.2,.
Arguments x, y — Measure values representing the horizontal/vertical position, in inches, of the starting point. width, height — Measure values representing the width/height, in inches, of the rectangle shape. Code Sample Example This example draws two identical rectangles. Note: To draw a rectangle that is both stroked and filled, use rectstroke and rectfill in succession.
4 Language Reference Argument expression — Boolean value. If it evaluates to true, the loop ends. If it evaluates to false, the loop repeats. Code Sample Example This example prints the string ‘Cheers’ ten times, one underneath the other, with a dashed line above and below the ten instances. Example show('---------------') crlf(0.16) &count := 1 repeat &count := &count + 1 show('Cheers') crlf(0.16) until(&count = 10) show('---------------') crlf(0.
Return Values Return value: Indicates: 0 The resource does not exist or could not be found. 1 A color bitmap. 2 A monochrome bitmap. 3 A grayscale bitmap. 4 An Encapsulated PostScript (EPS) image. 5 A PostScript file. 6 A Portable Document Format (PDF) file. Code Sample Example This example sets the variable &resolution to 200 DPI if the resource is a color bitmap, and to 75 DPI if it is not.
4 Language Reference Example define(&data,string,'This is a~sample string') define(&x,integer, pos('~', &data)) %Find tilde if(&x>1) show(right(&data,length(&data)-&x)) %Show remainder of string endif() RunPS (procedure) This command is typically used to call resources, usually images, downloaded either with the Image Downloader in PlanetPress Design or Send Images to Printer action tasks in PlanetPress Watch. Note that this command does not work with any other PostScript files.
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. Syntax search( target, search ) … endsearch() Arguments target — Name of a variable of type string in which to perform the search. search — String value to search for. Code Sample Example This example splits a string delimited with semi-colons.
4 Language Reference Arguments width, height — Integer values specifying, in points, the width and height respectively of the physical page. There are 72 points to an inch. media — A string value specifying the type of paper to use. color — String value specifying the color of the paper. weight — Integer value specifying the weight of the paper to use, in grams per square meter. You can convert weight in pounds to weight in grams by multiplying by the weight in pounds by 3.76.
SetAngle (procedure) This command rotates all subsequent commands by the angle specified. Most commands and objects that are displayed/printed on the document are affected by the setangle command. Syntax setangle( angle ) Argument angle — Measure value specifying the angle of rotation in degrees for all subsequent commands. Use a positive value for counter-clockwise motion and a negative value for clockwise motion. This value is relative to the current angle, not absolute.
4 Language Reference SetDash(procedure) Set the properties of a dashed line. Any drawing done after setdash() draws dashed instead of solid lines. You can revert to solid lines by calling setdash() with an empty array as a parameter. Syntax setdash( [dashlength, spacelength] ) Argument dash — Measure value specifying the length, in inches, of each of the dashes in the dashed line. space — Measure value specifying the length, in inches, of the space between each of the dashes in the dashed line.
Arguments address — String value specifying the email address. SetEmailSubject (procedure) Defines the subject line of an email message sent by PlanetPress Image. Syntax setemailsubject( subjectline ) Arguments subjectline — String value specifying the subject line. SetEmulation(procedure) Sets the emulation to use. Syntax setemulation( emulation ) Argument emulation — Integer value indicating the type of emulation.
4 Language Reference Arguments info — String value specifying a description of the fax. Code Sample Example setfaxinformation( 'purchase confirmation' ) SetFaxNumber (procedure) Defines a fax number for PlanetPress Fax. Syntax setfaxnumber( faxnumber ) Arguments faxnumber — String value specifying the fax number. Code Sample Example setfaxnumber( '(514)276-7633' ) SetFillColor (procedure) Sets the colour used to paint the insides of any closed shapes when issuing a fill or a strokeandfill command.
SetStyle (procedure) Sets the style to be used for all subsequent commands. The specified style must already exist in the document. Note: SetStyle() supercedes the SetFont() command. Although PlanetPress Talk still recognizes SetFont(), this behavior is unlikely to continue in future versions, and it is therefore highly recommended that you use the SetStyle() command in your scripts. Syntax setstyle( stylename ) Argument stylename — Name of the style to use for all subsequent commands.
4 Language Reference Arguments stylename — The name of the style. The name of the style must be preceded by an ampersand. You can set the bold, italic, or bold italic property of the style by appending .b, .i, or .bi respectively to the name of the style. Note: The ability to append .b, .i, or .bi to style names that have double-byte character sets is not supported. fontsize uses — Measure value representing the point size for the font.
Example 2 setimageindex( 'PONumber', @(2,24,32) ) SetLineWidth (procedure) Sets the width of the pen used for drawing lines, boxes and other 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. Syntax setlinewidth( width ) Argument width — Measure value setting the width, in inches, of the drawing pen. Code Sample Examples Example 1 sets the pen width to 1/4 inch.
4 Language Reference Syntax setpdfbookmark( name ) Arguments name — String value specifying the name of the bookmark that appears in the PDF. Code Sample Examples These examples illustrate setpdfbookmark(). Example 1 setpdfbookmark('Table of Contents') Example 2 setpdfbookmark( @(10,23,45) ) Example 3 setpdfbookmark( @(10,23,45) + '|' + @(11,23,45) ) SetStrokeColor (procedure) Sets the colour of the pen used for drawing lines, boxes and other objects.
Show / ShowCenter / ShowRight (procedure) These 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 uses the margin 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.
4 Language Reference showbarcode needs 3 additional parameters before it can display the barcode. These parameters must be set before calling showbarcode, using the following variables: BarWidth — Measure value setting the width of each bar, in inches. BarHeight — Measure value setting the height of each bar, in inches. BarType — Integer value specifying the type of barcode to print.
Arguments string — String value containing either the name of the bitmap resource within the document, or the path to a bitmap file. resolution — Integer value specifying the resolution, in pixels per inch, at which the bitmap displays. A larger number yields a smaller, clearer image, since more pixels are squeezed into a smaller space. But the bitmap then requires more memory. Except in some very specific applications, it is rarely desirable to use resolutions exceeding 100 ppi.
4 Language Reference endif() ShowEPS (procedure) Displays an EPS image resource. Syntax showeps( resname, width, height ) Argument resname — String value containing either the name of the EPS resource within the document, or the path to an EPS file . width, height — Measure values specifying the width/height, in inches, the EPS occupies when it displays. Specifying a value of zero for one but not both of the two dimensions scales the EPS to fit the non-zero dimension.
Code Sample Example This example shows how to fit strings of different sizes within the same box that has a width of 3 inches. Example margin(0,0) rectstroke(0,0,3,3) moveto(0,0.5) showleftright('This fits well inside the box',3) crlf(0.1599) showleftright('But this one is a little more tight',3) ShowPage (procedure) Instructs the printer to output the page and move on to the next instruction. Note: This command has no effect on screen, because it is intended to be executed only inside the printer.
4 Language Reference Syntax showpdf( resname, pagenum, width, height ) Argument resname — String value containing either the name of the PDF resource within the document, or the path to a PDF file . pagenum — Integer value specifying the page number within the PDF image resource. width, height — Measure values specifying the width/height, in inches, the PDF page occupies when it displays.
Example setlinewidth(0.007) moveto(0,0) rlineto(&width,0) rlineto(0,&height) rlineto(neg(&width),0) rlineto(0,neg(&height)) closepath() stroke() moveto(&width/2,&height/18) BeginUTF8Paragraph(0.0000,&width,0.0000,'leftright',0.1667,'rtl') SetStyleExt(&Style1,12.0000,0,[100],100) ShowUTF8('\u0623\u0633\u0627\u0633\u064B\u0627\u060C') EndUTF8Paragraph() ShowUTF8Left / ShowUTF8Right / ShowUTF8Center (procedure) These three commands are used to display simple text strings on the document.
4 Language Reference Code Sample Examples Example 1 illustrates a static text string (the name Saudi Arabia) escaped to its UTF8 reference form that will be displayed from the insertion point to the left. Example 2 shows a variable text string that is taken from the data, converted from the MS-CP-1256 encoding to UTF8 and then displayed from the insertion point to the right. Example 1 setlinewidth(0.
Syntax sin( value ) measure value Argument value — Measure value specifying the angle whose sine is returned. Code Sample Example This example draws a somewhat sinusoidal graph. Example moveto(0,0) define(&i,integer,0) for(&i,1,10,360) lineto(cos(inttofloat((&i)/ 4)),sin(inttofloat(&i))) endfor() closepath() StopJob (procedure) Terminates execution of the document and returns control to the PostScript interpreter.
4 Language Reference Code Sample Example This example is taken for an OnReadDataPage event for a user defined emulation. It shows how to store lines of text in the current data page. It searches for a formfeed, increases the current line, stores the string, executes the document, resets the page, and then ends the search. Example search(&str,'\014') set(¤t.line,¤t.line+1) store(¤t.line,&str) doform() clearpage() endsearch() &Str (system variable) Contains a line of input data.
Arguments string — String in which you want to replace a pattern. old — String value that defines the pattern you want to replace. new — String value that represents the replacement pattern. Code Sample Example This example replaces the dollar currency symbol with the pound currency symbol. Example stringreplace('1,000.00$','$','£') StringWidth (function) Returns the physical display width, in inches, of a string.
4 Language Reference StringWidthUTF8 (function) Returns the length, in inches, of the string as it would be displayed on a page, using the current font. Bear in mind that the combination of many bytes sometimes results in a single glyph and that text orientation can also affect the number of glyphs displayed. Syntax stringwidthutf8(text, mode) Arguments text — UTF8 text string to be measured. mode — String specifying how the contextual analysis is to be performed.
Syntax stroke() Argument None Code Sample Example This example draws a blue triangle with a blue border. Example setstrokecolor([100,100,0,0]) %Set pen colour to blue moveto(1,1) lineto(1.5,2) lineto(0,2) closepath() stroke() StrokeAndFill (procedure) Outlines 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.
4 Language Reference lineto(1.5,2) lineto(0,2) closepath() strokeandfill() StrToCur (function) Converts a string value into a currency value. Syntax strtocur( string ) currency value Argument string — String value to convert. StrToFloat (function) Converts a string into a measure value. Syntax strtofloat( string ) measure value Argument string — String value to convert.
StrToInt (function) Converts a string into an integer value. Syntax strtoint( string ) integer value Argument string — String value to convert. Code Sample Example This example reads a column of 6 values then converts the values to integers and then adds the integer to the &total variable. The total value is subsequently converted back to a string and the result is printed.
4 Language Reference Example 2 show(floattostr(sub(4.7,2.1))) SubRecCount (function) Returns the number of records per data page. Since data pages can hold 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.
show(floattostr(&tot))s System (system object) The system system object contains system variables related to the Raster Image Processor (RIP) the document is using to execute, and document versioning. These system variables are read-only. Syntax &system.product string value &system.version string value &system.formversion integer value Properties product — String value containing the name of the RIP the document is using to execute.
4 Language Reference Argument displayseconds — Boolean specifying whether to display the time using seconds. True returns the time with seconds, False, without. The precise format of the of the time value strings are set in the Windows Regional options. Code Sample Example This example shows how to add the current time with seconds (11:14:46 AM, as opposed to 11:14 AM, for example) on a document page.
show('some more text') Example 3 translate(-2,-2) Trim (function) Removes both leading and trailing spaces from a string. Syntax trim( string ) string value Argument string — String value from which you want to trim leading and trailing spaces. Code Sample Example This example trims leading and trailing spaces from the data selection on line 3, columns 8 to 24. Example trim(@(3,8,24)) TrimLeft (function) Removes leading spaces from a string.
4 Language Reference TrimRight (function) Removes trailing spaces from a string. Syntax trimright( string ) string value Argument string — String value to trim. Code Sample Example See “TrimLeft (function)” on page 163. UpperCase (function) Convert a string to all upper case characters. Syntax uppercase( string ) string Argument string — String value you want to convert to upper case. The string may be a mix of upper and lower case characters.
XOr (Boolean operator function) Returns true if only one of two specified expressions is true, false otherwise. Syntax xor( expression1, expression2 ) ' boolean value expression1 xor expression2 boolean value Arguments expression1, expression2 — Boolean values. Code Sample Examples These examples illustrate the possible values for XOR.
4 Language Reference Example xmlcount('/agency/crew') xmlGet() Retrieves values through the structure of an XML file. This function uses a single parameter specifying the XPath of the value to be retrieved. This function returns a string. The return value is an empty string if no value is found or if the specified Element is invalid or not found. Syntax xmlget('XPath') Arguments XPath — A single parameter specifying the value to be retrieved.
Conversion Tables This appendix contains an ASCII conversion table, a table for converting from points to inches, another for converting from points to centimeters, and a table for determining the height of a line of text given the number of Lines Per Unit (LPU).
A Dec 168 Hex Oct Char 14 0E 016 SO (shift out) 15 0F 017 SI (shift in) 16 10 020 DLE (data link escape) 17 11 021 DC1 (device control 1) 18 12 022 DC2 (device control 2) 19 13 023 DC3 (device control 3) 20 14 024 DC4 (device control 4) 21 15 025 NAK (negative acknowledge) 22 16 026 SYN (synchronous idle) 23 17 027 ETB (end of trans.
ASCII Conversion Table Dec Hex Oct Char 47 2F 057 / 48 30 060 0 49 31 061 1 50 32 062 2 51 33 063 3 52 34 064 4 53 35 065 5 54 36 066 6 55 37 067 7 56 38 070 8 57 39 071 9 58 3A 072 : 59 3B 073 ; 60 3C 074 < 61 3D 075 = 62 3E 076 > 63 3F 077 ? 64 40 100 @ 65 41 101 A 66 42 102 B 67 43 103 C 68 44 104 D 69 45 105 E 70 46 106 F 71 47 107 G 72 48 110 H 73 49 111 I 74 4A 112 J 75 4B 113 K 76
A 170 Dec Hex Oct Char 80 50 120 P 81 51 121 Q 82 52 122 R 83 53 123 S 84 54 124 T 85 55 125 U 86 56 126 V 87 57 127 W 88 58 130 X 89 59 131 Y 90 5A 132 Z 91 5B 133 [ 92 5C 134 \ 93 5D 135 ] 94 5E 136 ^ 95 5F 137 _ 96 60 140 ` 97 61 141 a 98 62 142 b 99 63 143 c 100 64 144 d 101 65 145 e 102 66 146 f 103 67 147 g 104 68 150 h 105 69 151 i 106 6A 152 j 107 6B 153 k 108 6C 154 l 109 6D 1
Points to Inches or Centimeters Dec Hex Oct Char 113 71 161 q 114 72 162 r 115 73 163 s 116 74 164 t 117 75 165 u 118 76 166 v 119 77 167 w 120 78 170 x 121 79 171 y 122 7A 172 z 123 7B 173 { 124 7C 174 | 125 7D 175 } 126 7E 176 ~ 127 7F 177 DEL Points to Inches or Centimeters Points are PostScript points. A PostScript point measures 1/72 of an inch, or 0.035278 of a centimeter. Points to Inches Points Inches Points Inches 1 0.
A 172 Points Inches Points Inches 21 0.291669 22 0.305558 23 0.319447 24 0.333336 25 0.347225 26 0.361114 27 0.375003 28 0.388892 29 0.402781 30 0.41667 31 0.430559 32 0.444448 33 0.458337 34 0.472226 35 0.486115 36 0.500004 37 0.513893 38 0.527782 39 0.541671 40 0.55556 41 0.569449 42 0.583338 43 0.597227 44 0.611116 45 0.625005 46 0.638894 47 0.652783 48 0.666672 49 0.680561 50 0.69445 51 0.708339 52 0.722228 53 0.736117 54 0.
Points to Inches or Centimeters Points Inches Points Inches 87 1.208343 88 1.222232 89 1.236121 90 1.25001 91 1.263899 92 1.277788 93 1.291677 94 1.305566 95 1.319455 96 1.333344 97 1.347233 98 1.361122 99 1.375011 100 1.3889 Points Centimeters Points to Centimeters Points Centimeters 1 0.035278 2 0.070556 3 0.105834 4 0.141112 5 0.176389 6 0.211667 7 0.246945 8 0.282222 9 0.3175 10 0.352778 11 0.388056 12 0.423334 13 0.458611 14 0.
A Points Centimeters Points Centimeters 45 1.587500 46 1.622778 47 1.658056 48 1.693333 49 1.728611 50 1.763889 51 1.799167 52 1.834445 53 1.869722 54 1.905000 55 1.940278 56 1.975556 57 2.010833 58 2.046111 59 2.081389 60 2.116667 61 2.151945 62 2.187222 63 2.222500 64 2.257778 65 2.293056 66 2.328333 67 2.363611 68 2.398889 69 2.434167 70 2.469445 71 2.504722 72 2.540000 73 2.575278 74 2.610555 75 2.645833 76 2.681111 77 2.
Line Height as a Function of Lines Per Unit (LPU) Line Height as a Function of Lines Per Inch Use this table to determine the height, in inches, of an individual line when the unit of the LPU is inches. LPI Line Height (inches) LPI Line Height (inches) 1 1 2 0.5 3 0.333333333 4 0.25 5 0.2 6 0.166666667 7 0.142857143 8 0.125 9 0.111111111 10 0.1 11 0.090909091 12 0.083333333 13 0.076923077 14 0.071428571 15 0.066666667 16 0.0625 17 0.058823529 18 0.055555556 19 0.
A 176 LPC Line Height (inches) LPC Line Height (inches) 3 0.181233596 4 0.098425197 5 0.078740157 6 0.065616798 7 0.056242970 8 0.049212598 9 0.043744532 10 0.039370079 11 0.035790980 12 0.032808399 13 0.030284676 14 0.028121485 15 0.026246719 16 0.024606299 17 0.023158870 18 0.021872266 19 0.020721094 20 0.019685039 21 0.018747656 22 0.017895490 23 0.017117425 24 0.016404199 25 0.015748031 26 0.015142338 27 0.014581511 28 0.014060742 29 0.
Index Symbols $element (procedure) 51, 63 % (procedure) 49, 62 * (operator) 45, 65 + (operator & function) 64 + (operator) 44, 45, 55 / (operator) 45, 65 := (operator) 44, 66 < (operator) 46, 65 <= (operator) 46, 66 <> (operator) 46, 66 = (operator) 46, 66 > (operator) 46, 65 >= (operator) 46, 65 @ (function) 50, 62 @name (function) 52, 63 @page (procedure) 51, 63 – (operator) 45, 65 A Add (function) 44, 66 add a comment 49 adjust sizes of the Commands area, Code area and Spy list 38 And (Boolean operator
Index characters, work with 56 ClearPage (procedure) 49, 78 ClosePath (procedure) 57, 78 Code area adjust the size of the 38 PlanetPress Talk 31 code execution in the PlanetPress Talk Editor 34 collapse command groups 38 color arrays 10 work with 56 command groups collapse 38 expand 38 command name completion 40 command syntax 6 commands 49 enter in the PlanetPress Talk Editor 38 Commands area adjust the size of the 38 PlanetPress Talk Editor 31 show or hide the 37 comment, add a 49 comments 6 comparison o
a new program in the PlanetPress Talk Editor 35 commands in the PlanetPress Talk Editor 38 &EOJob (system variable) 42, 88 EPSHeight (function) 54, 88 EPSWidth (function) 54, 88 Eq (function) 46, 89 equations 7 evaluate an expression or statement 7 ExecPage (procedure) 51, 89 execute documents and document pages 51 exit the PlanetPress Talk Editor 37 Exit (procedure) 48, 90 expand command groups 38 export a PlanetPress Talk program 35 expression, evaluate an 7 F Field (function) 50, 91 FieldCount (function)
Index LineTo (procedure) 57, 111 local variables 13 loop structures 48 LowerCase (function) 55, 111 LT (function) 46, 112 M MapUTF8 (function) 112 Margin (procedure) 55, 114 mathematical operators and operator functions 44 measure, unit of 7 measures 9 Mid (function) 56, 115 Mod (function & procedure) 45, 115 MoveTo (procedure) 58, 116 Mul (function) 45, 117 N names of variables, global functions, objects, styles 7 NE (function) 46, 117 Neg (function) 45, 118 Not (Boolean operator function) 45, 118 O Objec
import 35 points convert to centimeters 173 convert to inches 171 Pos (function) 56, 125 PostScript, work with 51 PPDs, work with 52 print a line of text on odd-numbered pages 26 page n-up 25 program 36 variable number of copies of a page based on a value in the datastream 23 &PrinterMode (system variable) 42, 126 program print a 36 save a 36 Put (procedure) 57, 127 R Random (function) 45, 128 RCurveTo (procedure) 57, 82 Rectangle (procedure) 58, 128 RectFill (procedure) 58, 129 RectFillStroke (procedure) 5
Index ShowPage (procedure) 51, 149 ShowPDF (procedure) 54, 149 ShowRight (procedure) 55, 145 ShowUTF8 (procedure) 150 ShowUTF8Center (procedure) 151 ShowUTF8Left (procedure) 151 ShowUTF8Right (procedure) 151 Sin (function) 45, 152 Spy list 31 adjust the size of the 38 show or hide the 37 statement, evaluate a 7 status bar PlanetPress Talk Editor 31 StopJob (procedure) 51, 153 Store (procedure) 49, 153 store two lines of input data on one line of the data page 24 &Str (system variable) 42, 154 string operat
work with arrays and color arrays 56 bar codes 53 characters 56 data pages 49 database records 50 emulations 49 global functions 52 images and attachments 54 objects 53 PostScript 51 PPDs 52 strings 55 styles 55 text 54 X XML functions 47 xmlCount() 165 xmlGet() 166 xmlResetRoot() 166 XOr (Boolean operator function) 46, 165 183
Index 184