Lexmark DOCUMENT DISTRIBUTOR, DOCUMENT DISTRIBUTOR 2.1 User Manual

Document Distributor
Script Reference
April 2002
www.lexmark.com
Edition: April 2002
The following paragraph does not apply to any country where such provisions are inconsistent with local law:
LEXMARK INTERNATIONAL, INC., PROVIDES THIS PUBLICATION “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions; therefore, this statement may not apply to you.
This publication could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in later editions. Improvements or changes in the products or the programs described may be made at any time.
Comments about this publication may be addressed to Lexmark International, Inc., Department F95/032-2, 740 West New Circle Road, Lexington, Kentucky 40550, U.S.A. In the United Kingdom and Eire, send to Lexmark International Ltd., Marketing and Services Department, Westhorpe House, Westhorpe, Marlow Bucks SL7 3RQ. Lexmark may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you. You can purchase additional copies of publications related to this product by calling 1-800-553-9727. In the United Kingdom and Eire, call +44 (0)8704 440 044. In other countries, contact your point of purchase.
References in this publication to products, programs, or services do not imply that the manufacturer intends to make these available in all countries in which it operates. Any reference to a product, program, or service is not intended to state or imply that only that product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any existing intellectual property right may be used instead. Evaluation and verification of operation in conjunction with other products, programs, or services, except those expressly designated by the manufacturer, are the user’s responsibility.
Lexmark and Lexmark with diamond design are trademarks of Lexmark International, Inc. registered in the United States and/or other countries.
© Copyright 2002 Lexmark International, Inc. All rights reserved.
UNITED STATES GOVERNMENT RESTRICTED RIGHTS
This software and documentation are provided with RESTRICTED RIGHTS. Use, duplication or disclosure by the 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 and in applicable FAR provisions: Lexmark International, Inc., Lexington, KY 40550.

Table of contents

Introduction ........................................................................ 1
Whats new in version 2.1 ....................................................... 2
Actions .......................................................................................2
Document Server Admin ...........................................................2
Documentation .......................................................................... 2
Chapter 1: The Basics .......................................................3
Objects ................................................................................... 3
Declaring Variables ................................................................ 4
Flow control ............................................................................ 4
If/Then/Else ...............................................................................4
Switch/Case ............................................................................... 5
Repetitive Statements ............................................................ 6
Loop ...........................................................................................6
Repeat .......................................................................................7
Operators ................................................................................ 9
Mathematical ............................................................................. 9
Comparison ............................................................................. 10
Boolean ................................................................................... 11
Other Features ..................................................................... 12
Object shorthand using "with" ..................................................12
Debugging a script ................................................................... 12
Prompting for values during compilation .................................12
Aborting a script during runtime ...............................................13
Reserved words .......................................................................13
i
Chapter 2: Data Type Objects ........................................14
Boolean ................................................................................ 15
Operators ................................................................................. 15
Document ............................................................................. 16
Methods ................................................................................... 16
Operators ................................................................................. 19
Integer .................................................................................. 20
Methods ................................................................................... 20
Operators ................................................................................. 21
Real ...................................................................................... 22
Methods ................................................................................... 22
Operators ................................................................................. 23
String .................................................................................... 24
Methods ................................................................................... 24
Operators ................................................................................. 27
Chapter 3: Helper Objects ..............................................29
Array ..................................................................................... 30
Methods ................................................................................... 30
Textfile .................................................................................. 31
Methods ................................................................................... 31
Chapter 4: System objects .............................................36
Original ................................................................................. 37
Userdata ............................................................................... 39
Confirm ................................................................................. 40
Chapter 5: Action objects ...............................................43
ConvertBarcodeToText ........................................................ 44
ConvertForm ......................................................................... 46
ii
ConvertImageFormat ............................................................ 47
ConvertToDocument ............................................................ 52
ConvertToText ...................................................................... 54
DatabaseNotes ..................................................................... 58
Domino.Doc Actions ............................................................. 61
DominoDocCheckIn .................................................................62
DominoDocRetrieve ................................................................67
Connecting to Domino.Doc ...................................................... 72
Navigating a Domino.Doc Library ............................................ 72
EmailExchange ..................................................................... 74
EmailNotes ........................................................................... 77
EmailSMTP ........................................................................... 80
E-mail Addresses ....................................................................81
Recipients and Senders .......................................................... 82
FaxByPrinter ......................................................................... 83
FTPget .................................................................................. 85
FTPput .................................................................................. 87
GroupWise Actions ............................................................... 89
GWMail .................................................................................... 90
GWDiscuss .............................................................................. 93
GWCheckIn ............................................................................. 96
ImageCombine ..................................................................... 99
ImageCrop .......................................................................... 101
ImageDeskew ..................................................................... 103
ImageInvert ......................................................................... 104
ImageMerge ....................................................................... 105
ImageRotate ....................................................................... 109
iii
ImageSeparate ................................................................... 111
ImageText ........................................................................... 112
LaunchExe .......................................................................... 115
Checking Return Values ........................................................118
ODBC actions ..................................................................... 119
Introduction ............................................................................ 119
ODBCWrite ............................................................................ 120
ODBCRead ............................................................................ 124
PrintASCII ........................................................................... 130
PrintByAssoc ...................................................................... 131
PrintByDriver ...................................................................... 133
PrintIP ................................................................................. 134
Print Confirmation ..................................................................137
PrintPDF ............................................................................. 138
PrintTIF ............................................................................... 139
PrintURL ............................................................................. 140
SaveToFile ......................................................................... 141
SharePoint .......................................................................... 144
SharePointWrite ....................................................................145
SharePointRead .................................................................... 148
Appendix A: Migrating from LDD 1.4 to LDD 2.1 ......... 154
Whats new since LDD version 1.4? ................................... 154
Whats changed? ................................................................ 155
Using the ImportWizard to convert scripts .......................... 156
Manually converting scripts ................................................ 157
Operator conversions ......................................................... 162
iv
Action name conversions ................................................... 164
Action property conversions ............................................... 165
Appendix B: LDD Constants Reference....................... 166
ConvertBarcodeToText ...................................................... 166
Type ....................................................................................... 166
ConvertImageFormat .......................................................... 167
Format ................................................................................... 167
Color depth ............................................................................ 167
ConvertToDocument .......................................................... 168
Format ................................................................................... 168
Paper size .............................................................................. 168
Orientation ............................................................................. 168
Resolution .............................................................................. 169
ConvertToText .................................................................... 170
Format ................................................................................... 170
Language ...............................................................................171
Filter ....................................................................................... 171
DatabaseNotes ................................................................... 172
Add field – Field type .............................................................172
Domino.Doc ........................................................................ 173
DominoDocCheckin ...............................................................173
DominoDocRetrieve ..............................................................173
EmailNotes ......................................................................... 175
Priority and Importance ......................................................... 175
Mood stamp ........................................................................... 175
Report delivery ......................................................................175
EmailSMTP ......................................................................... 176
Character set ......................................................................... 176
FTPget/FTPput ................................................................... 177
Transfer mode .......................................................................177
v
GWDiscuss ......................................................................... 178
Message format .....................................................................178
Priority .................................................................................. 178
GWMail ............................................................................... 179
Message format .....................................................................179
Priority .................................................................................. 179
Request reply ........................................................................ 179
Notify opened and Notify deleted .......................................... 179
ImageCombine ................................................................... 180
Format ................................................................................... 180
Color depth ............................................................................ 180
ImageRotate ....................................................................... 181
Rotate pages ......................................................................... 181
Rotation angle ....................................................................... 181
ImageText ........................................................................... 182
Font ....................................................................................... 182
Color ...................................................................................... 182
Orientation ............................................................................. 182
Direction ................................................................................ 182
Position .................................................................................. 183
PrintIP ................................................................................. 184
Paper type ............................................................................. 184
N-up ....................................................................................... 184
Duplex ................................................................................... 185
Output bin ..............................................................................185
SharePoint .......................................................................... 186
SharePointWrite ....................................................................186
Appendix C: ODBC Reference ...................................... 187
Software requirements and setup ....................................... 187
Database document support ................................................. 188
Inserting values into Date Columns ....................................... 188
vi
Appendix D: Barcode Re f e renc e . ... ................. .. .. ... ....... 189
LDD_BARCODE_CODE25 ................................................ 189
LDD_BARCODE_CODE39 ................................................ 190
LDD_BARCODE_CODE93 ................................................ 190
LDD_BARCODE_CODE128 .............................................. 190
LDD_BARCODE_CODABAR ............................................. 191
LDD_BARCODE_EAN13 ................................................... 191
LDD_BARCODE_ITF ......................................................... 191
LDD_BARCODE_PDF417 ................................................. 192
LDD_BARCODE_POSTNET .............................................. 192
LDD_BARCODE_UCC128 ................................................. 192
LDD_BARCODE_UPCA ..................................................... 193
LDD_BARCODE_UPCE ..................................................... 193
vii

Introduction

This book provides a technical reference for LDDScript, the scripting language for the Lexmark Document Distributor. It is assumed you are already familiar with the language; if not, please review the "Basic Script Writing" book installed with this product.
If you are migrating from LDD version 1.4, start with Appendix A, "Migrating from LDD 1.4 to 2.1".
The Script Reference is organized as follows:
Chapter 1, "The Basics"—Quick overview of the basic constructs of LDDScript. For detailed examples, please see the "Basic Script Writing" book.
Chapter 2, "Data Type Objects" Information on the supported data types.
Chapter 3, "Helper Objects"Information on the objects that are used to perform common
operations
Chapter 4, "System Objects"—Information on the objects that provide the data provided with a submitted job and provide feedback to the end-user.
Chapter 5, "Action Objects"—Information on the objects that perform the actual processing of documents to route, store in a database, print, and so on.
Appendix A, "Migrating from LDD 1.4 to 2.1"—Information for users migrating from previous versions of LDD.
Appendix B, "LDD Constants Reference"Quick lookup of all the constants used in LDDScript.
Appendix C, "ODBC Reference"Information about interfacing with databases from within a script.
Appendix D, "Barcode Reference"Information about the barcodes supported by LDDScript.
1

What’s new in version 2.1

Lexmark Document Distributor 2.1 has enhanced many of its standard features as well as added some brand new function. Additions and enhancements include:

Actions

PrintIPNow supports Staple and Print Confirmation (WaitForCompletion and WaitTimeout
properties)
New actions
ImageText ActionPlace text anywhere on an image
Electronic Document Manipulation (EDMS) actions that include third party database software;
SharePoint and Domino.Docs

Document Server Admin

Script Editor improvements that include:
find/replaceUse the find/replace tool to take you to the code you want
printPrint a hard copy of your script from the Script Editor
insert logicAutomatically insert logic syntax into your script
auto-completeAutomatically finishes your actions
auto-indentAutomatically indents your script when inserting a sub-routine

Documentation

Expanded documentation including:
Basic Script WritingDocumentation to help you get started writing your first script
Script ExamplesDetailed script examples (included with LDD) with line–by–line explanations
of the code
Server Admin Tour—Take a detailed tour of the tools available in your Document Server
Admin
2
1

The Basics

Objects

An object is the basic building block of LDDScript. An object contains properties and methods. A property is one of the basic data type objects such as a string or integer. A property is set to various values to affect how the object operates. A method is a function called to operate on the data. A method may be passed parameters and may return a value. The parameters and return values are data type or helper objects.
Dot notation is used to access the properties and methods of an object.
To set the value of a property:
ObjectName.propertyName = value
To call a method:
ObjectName.MethodName() ObjectName.MethodName(param1, param2) returnValue = ObjectName.MethodName(param1)
LDDScript supports four types of objects:
Data TypeThe most basic objects; all properties and most variables are of this type.
HelperProvide an easy way to perform some common operations.
SystemDo not process documents; used to gather input and provide user feedback.
ActionProcess documents; perform the archiving, routing, distribution, etc.
The remaining chapters in this book provide a reference for objects of each type.
3

Declaring Variables

All variables must be declared before they can be used. Variables cannot be declared inside of a "with" block or inside of any logic blocks like if/then or loops. To declare a variable, specify its object type and name. For example:
string text int num
There are some rules to follow when naming your variables:
Name must consist of letters, numbers, and underscores.
The first character of the name must be a letter.
Must be unique within the script, the names are not case sensitive so "Name", "NAME", and
"name" are all considered the same variable name.
Cannot be a reserved word (one that has a special meaning to the script compiler).

Flow control

In order to control the execution of script statements, some type of flow control logic is necessary. Script statements can be executed three ways: sequentially, selectively, or repetitively.
When no flow control logic is used, the statements are executed in the order they are in the script. For selective execution of certain script statements, you can use if/then/else or switch/case statements. For repetitive execution of script statements, the loop and repeat statements can be used.
These flow control statements are discussed next.

If/Then/Else

The most common type of flow control is the ability to execute a statement if a certain condition is true. This ability is implemented in Document Server by the if/then/else construct. The basic format is:
if (bool expression) then statement1 statementn endif
statement1 to statementn are only executed if the Boolean expression in parentheses is TRUE. Sometimes it is also necessary to evaluate one set of statements if a condition is TRUE and another if it is FALSE. That can be accomplished using the else construct:
if (bool expression) then statementa
statementc
else statementx
statementz
endif
statementa to statementc are executed if the Boolean expression in parentheses is TRUE; otherwise, statementx to statementz are executed.
4

Switch/Case

Sometimes you have more than one condition you want to check for. You can do this with several If/Then statements. The Switch/Case statement provides an easier way to make multiple comparisons:
Integer switch String switch
switch (intvar) switch (stringvar)
case intval1 case "stringval1"
statementa statementa statementb statementb
case intval2 case "stringval2"
statementc statementc statementd statementd
default default
statemente statemente statementf statementf
endswitch endswitch
You can use integer or string values with the Switch/Case statement. Based on the value of the variable, the case block corresponding to that value is executed. Each case block can contain multiple statements but only one case block is executed.
If the value of the switch variable does not match any of the cases, the default block is executed. The default block is not required. However, if a default block is used, it must be the last block.
Example of Switch
Lexmark MFPs have a job accounting capability. When this feature is enabled, users must enter an account number before accessing a profile. For this example, users enter a department number when using profiles. This example script uses a Switch/Case statement to check the department number.
string CustomSubject // Use the account number as an integer int DeptNumber = original.useracct.AsInt() switch (DeptNumber) case 35 CustomSubject = "Document from Human Resources" case 41 CustomSubject = "Document from Legal Department" case 15 CustomSubject = "Document from Shipping Department" default CustomSubject = "Document from FooBar Company" endswitch
with EmailSMTP .Server="mailserver.com" .To="barbarab@foobar.com" .From="LDDTrain@lexmark.com" .Subject=CustomSubject .Message="Please read." .CharacterSet=LDD_SMTPCHARSET_US .Attachments=original.document .Go() endwith
5

Repetitive Statements

Each statement in a script is executed only once. The repeat and loop statements let you execute the same block of statements multiple times. You can insert an empty repeat or loop statement by clicking the Insert Logic button on the Script Editor toolbar.

Loop

When you want to repeat a set of statements a known number of times, use the loop statement.
Syntax:
loop (intcounter from istart to ifinish) statement1 statementn endloop
where:
intcounter is a previously declared integer variable
istart is an integer value to assign to intvar when the loop starts
ifinish is an integer value that is the maximum for intvar
Using an integer variable as a counter, the loop is repeated as many times as specified in the istart/ifinish information. You can include as many statements as you want in the loop block.
The loop block ends with the endloop statement. The loop begins with the counter variable being assigned the value indicated by istart. With each
execution of the loop, the value of the counter is incremented by 1. This continues until the counter is greater than the value of ifinish.
So a loop from 1 to 10 repeats until the counter has a value of 11. The value of istart must be less than the value of ifinish.
The integer variable used for the counter must be declared prior to using it in the loop statement.
Example:
E-mail the originally scanned document to ten customer service representatives. In this script, the common EmailSMTP properties are specified before the e-mails are sent inside the Loop statement.
string EmailAdd int LoopCount // Set up the common properties for the emails. with EmailSMTP .Subject="Customer Complaint" .Server="mail.server.com" .From="customer_service@foobar.com" .Message="Please review this complaint" .Attachments=original.document .CharacterSet=LDD_SMTPCHARSET_US endwith loop (LoopCount from 1 to 10) EmailSMTP.To="CustRep" + LoopCount.AsString() + "@foobar.com" EmailSMTP.Go() endloop
6

Repeat

The repeat statement lets you execute a block of statements over and over until an expression becomes true.
repeat (until bool expression)
statement1 statementn
endrepeat
The repeat statement executes the block of statements until the Boolean expression is TRUE. You can have as many statements as you want in the loop block. The endrepeat statement ends the loop block. If the initial value of the Boolean expression is true, the loop is not executed.
Example:
This script uses Optical Character Recognition (OCR), to check documents scanned by end users for confidential documents. If the document is confidential it is not e-mailed. The scanned image is saved to a file and a warning message sent to the user who scanned the confidential document.
with ConvertToText .input=original.document .Format=LDD_TEXTFORMAT_STANDARD_WIN .AllPages=TRUE .Language=LDD_LANG_ENGLISH .CharacterTypes=LDD_FILTER_ALLCHARS .SpellCheck=TRUE .KeepFormat=FALSE .WholePage=TRUE .Go() endwith textfile tf string OneLine, Submitter
// Open the results of the OCR Action tf.Open(ConvertToText.output) bool bConfDoc = FALSE int iCount, iEnd iCount =1 iEnd = tf.GetNumberLines()
Submitter = original.username+ "@lexmark.com"
// Check each line for the term Confidential repeat (until (bConfDoc OR (iCount>=iEnd))) OneLine = tf.ReadLine() if (OneLine.Contains("Confidential"))
then
bConfDoc = TRUE
endif iCount.Add(1) endrepeat
7
// If it's a Confidential Document, save it and send warning message if (bConfDoc) then
with SaveToFile .input=original.document .Path="c:\ebc.txt" .AppendTimestamp=TRUE .Overwrite=FALSE .SaveUserData=FALSE .Go() endwith
with EmailSMTP .Server="mail.server.com" .To= Submitter .From="mailcheck@abcxyz.com" .Subject="Invalid Email Rejected" .Message="Cannot email a confidential document" .CharacterSet=LDD_SMTPCHARSET_US .Go()
endwith else
with EmailSMTP .Server="mail.server.com" .To="Receiver@abcxyz.com" .From=Submitter .Subject="Scanned Document" .Message="Here is the document you requested" .CharacterSet=LDD_SMTPCHARSET_US .Attachments=original.document .Go()
endwith endif
8

Operators

Mathematical

These operators are used to set or change the value of a variable or property.
Operator Symbol Description
Addition + For integer and real objects, this
Subtraction - For integer and real objects, this
Multiplication * For integer and real objects, this
Division \ For integer and real objects, this
adds the numbers on both sides of the "+" and returns the new value. For string objects, this has a similar affect as the concatenate method. It appends the string on the right to the string on the left and return the new string. For document objects, it appends the document on the right to the document on the left and return the new document. In all cases, the variables on either side remain unchanged.
subtracts the number on the right from the number on the left and return the new value. The variables on either side remain unchanged. It is not valid for any other object types.
multiplies the numbers on both sides of the " * " and return the new value. The variables on either side remain unchanged. It is not valid for any other object types.
divides the number on the left by the number on the right and return the new value. The variables on either side remain unchanged. It is not valid for any other object types.
Modulo % For integer objects, this divides the
number on the left by the number on the right and return the remainder. The variables on either side remain unchanged. It is not valid for any other object types. For example, 5/2 returns 1 since 5 / 2 is 2 with remainder 1.
9

Comparison

These operators are used to compare the values of variables or properties of the same type. The result of the comparison is a boolean value (TRUE or FALSE). Any of the symbols listed for an operator can be used.
Operator Symbols Description
Less Than <, LT For integers and reals, returns TRUE if the value
Greater Than >, GT For integers and reals, returns TRUE if the value
Less Than or Equal To <=, LE For integers and reals, returns TRUE if the value
Greater Than or Equal To >=, GE For integers and reals, returns TRUE if the value
Equal To == , EQ
(double equal sign)
Not Equal To !=, <>, NE For integers and reals, returns TRUE if the value
on the left is less than the value on the right. For strings, returns TRUE if the value on the left comes alphabetically before the value on the right (including case). Returns FALSE otherwise.
on the left is greater than the value on the right. For strings, returns TRUE if the value on the left comes alphabetically after the value on the right (including case). Returns FALSE otherwise.
on the left is less than or equal to the value on the right. For strings, returns TRUE if the value on the left comes alphabetically before or is the same as the value on the right (including case). Returns FALSE otherwise.
on the left is greater than or equal to the value on the right. For strings, returns TRUE if the value on the left comes alphabetically after or is the same as the value on the right (including case). Returns FALSE otherwise.
For integers and reals, returns TRUE if the value on the left is equal to the on the right. For strings, returns TRUE if the value on the left is exactly the same (including case) as the value on the right. Returns FALSE otherwise.
on the left is not equal to the on the right. For strings, returns TRUE if the value on the left is not exactly the same (including case) as the value on the right. Returns FALSE otherwise.
10

Boolean

These operators are used to build complex boolean expressions. Each value on either side of the operator must be a boolean value. The result of the boolean operator is a boolean value (TRUE or FALSE). Any of the symbols listed for an operator can be used.
Operator Symbols Description
And &, &&, AND ANDs two boolean values to get the final boolean
Or |, ||, OR ORs two boolean values to get the final boolean
Not !, NOT NOTs a boolean value to get the final boolean
result.
result.
result.
The following table shows the results of the AND and OR methods using:
bool1 AND bool2
bool1 OR bool2
bool 1 bool2 AND OR
FALSE FALSE FALSE FALSE
FALSE TRUE FALSE TRUE
TRUE FALSE FALSE TRUE
TRUE TRUE TRUE TRUE
11

Other Features

Object shorthand using "with"

If you have a section code that is working with the same object, it can be cumbersome to continually type the object name. To avoid this, you can use the with statement. The general format is:
with objectname
.property = value .property = value .method()
endwith
You state the object name being used in the with statement and then you can refer to any property or method of the object by simply using the "dot" followed by the property or method name. This is most commonly used with the action objects.

Debugging a script

When a script executes, the action objects can write error and warning messages to the log. You can also write your own messages to the log to help debug your script.
For example, you may want to know the value of a variable or the return value of a method. To write your message to the log use the "debug" statement.
debug msg
msg can be a string variable, a string in quotes, or a numeric expression. Below are some examples:
int index= 3 string ErrorMsg = "Failed to print" debug index debug ErrorMsg debug "Job received from " + original.username
Each of these writes a message to the server log.

Prompting for values during compilation

There may be circumstances when you do not want the sensitive data (such as userids or passwords) to appear in the script for everyone to see. In that case, you can prompt for the data during script compilation. This data is not visible in the script itself and it does not exist in an uncompiled form. To use this feature, you use the preprocessor prompt directive:
#prompt{prompt msg}
The prompt message you want displayed is placed between the braces ( {} ). You cannot use a string variable here and the text should not be in quotes. This is because the prompt is processed before the compiler is in use and thus you cannot use other objects. The value returned by the prompt is a string and contains whatever text was entered by the user.
The prompt can be placed anywhere a string is expected, such as:
FTPget.username = #prompt{Enter your FTP username}
12
If the prompt is used where a number is expected, assign a string to the value returned by the prompt and then use the AsInt method. For example:
string copies = #prompt{Enter number of copies} PrintIP.copies = copies.AsInt()

Aborting a script during runtime

If you detect an error condition during script execution, it is useful to have a means of halting the script processing. To accomplish this, you use the exit function:
void exit(string msg)
The exit function halts processing of the script. It lets you pass a string which appears in the server’s log as well as on the confirmation page/dialog.

Reserved words

A variable may not be any reserved word that already has a special meaning in the script language. The following is the list of reserved words:
If
Then
Else
Endif
Switch
Case
Default
Endswitch
Loop
Exit
From
To
Endloop
Repeat
Until
Endrepeat
String
Textfile
Int
Confirm
Doc
Bool
Binary
BinaryFile
Original
Real
Endwith
Userdata
Log
Prompt
13
2

Data Type Objects

All data used by the Document Distributor can be grouped into five distinct data types:
Boolean
Document
Integer
Real
String
Every object property is one of the Data Type Objects. In addition, most variables are one of these types. Following is a discussion of each of these objects.
14

Boolean

The Boolean object is used for values that are logically true or false. The only valid values for this variable are the reserved words: TRUE and FALSE.
The object has no properties. The following operators are supported:

Operators

Symbol Description
==, EQ Equals
<> Not Equal
&, AND And
|, OR Or
!, NOT Not
= Assignment
15

Document

The document object is used to hold a collection of image, text, and other formatted files. All files in a document object do not have to be of the same type; it can be used to hold different files of different types.
A property or variable is of this type when declared as doc. The document object has no properties.

Methods

Syntax Description
bool AddDocument(doc doc1) Adds an existing document to the end of this document.
Parameters:
doc1 – document to be added
Returns:
A bool indicating success or failure.
bool AddFile(string path [, string type]) Adds an existing file to the end of this document. This method
will fail if the file does not exist or could not be read. Parameters:
path – fully qualified path of the file on the server to be added
type – if not supplied, the file type will be set to the extension of the file being added; otherwise, the value supplied will be used.
Returns:
A bool indicating success or failure.
void Clear() Removes all files from the document.
Parameters:
None
Returns:
None
doc CopyRange(int start, int end) Copies the specified files in this document to a new document;
this actually makes a copy of the files so two copies of the files now exist. Doing this allows changes to be made to one set of the files without affecting the other set.
Parameters:
start – index of the first file in document to copy; file indexes start at 1
end – index of the last file in document to copy
Returns:
A doc that contains a copy of the files in the specified range.
16
Syntax Description
doc Copy() Copies all the files in this document to a new document; this
int GetDocumentSize() Returns the total size in bytes of all the files in this document.
string GetDocumentType() Returns the type (file format or extension) of the document. If
doc GetFile(int filenum) Returns a reference to the specified file; the returned
string GetFileLabel(int filenum) Returns the label for the specified file. The label is used as the
int GetFileSize(int filenum) Returns the size in bytes of the specified file. A value of zero
actually makes a copy of the files so two copies of the files now exist. Doing this allows changes to be made to one set of the files without affecting the other set.
Parameters:
None
Returns:
A doc that contains of the copy all the files.
A size of zero (0) is returned if no files are in the document.
Parameters:
None
Returns:
An int with the total number of bytes in this document.
all the files in the document are the same type, the value is the document type; otherwise, the value is an empty string.
Parameters:
None
Returns:
A string containing the document type (file format or extension) of the document.
document is not a copy, so any change made to this file affects the original. An empty document is returned if filenum is invalid.
Parameters:
filenum – index of file to get; file indexes start at 1
Returns:
A doc containing a reference to the specified file.
filename (minus the extension) for attachments in e-mails or databases. An empty string is returned if filenum is invalid.
Parameters:
filenum – index of file label to get; file indexes start at 1
Returns:
A string containing the label of the specified file.
(0) is returned if filenum is invalid. Parameters:
filenum – index of file size to get; file indexes start at 1
Returns:
An int containing the size in bytes of the specified file.
17
Syntax Description
string GetFileType(int filenum) Returns the type (file format or extension) of the specified file.
doc GetFileRange(int start, int end) Returns a reference to the specified files; the returned
int GetNumberFiles() Returns the number of separate files in this document. This
bool SetFileLabel(int filenum, string label) Sets the label for the specified file; this label is used as the
An empty string is returned if filenum is invalid.
Parameters:
filenum – index of file type to get; file indexes start at 1
Returns:
A string containing the value of file type of the specified file.
document is not a copy, so any change made to these files affects the original.
Parameters:
start – index of first file to get; file indexes start at 1 end – index of last file to get
Returns:
A doc containing a reference to the specified files.
does not return the number of pages. Parameters:
None
Returns:
An int with the number of files in this document.
filename (minus the extension) for naming attachments in e-mail or databases. This method fails if filenum is invalid.
Parameters:
filenum – index of file; file indexes start at 1
label – label to give specified file; since it is used as a filename, the label must follow the rules of file naming.
Returns:
A bool indicating success or failure.
void SetFileLabelAll(string label) Sets the labels of all the files in this document; this label is
used as the filename (minus the extension) for naming attachments in e-mail or databases.
Parameters:
label – label to give all the files; since it is used as a filename, the label must follow the rules of file naming.
Returns:
None
Note: For variables of type doc, assigning the variable is simply a reference. In other words, both
variables point to the same physical set of files that make up the document. So when you make a change to one of the files, that file is changed in both documents. To make different working copies of the files, use the Copy or CopyRange methods of the doc object.
18

Operators

Symbol Description
+ Add (same as calling AddDocument)
[] Index (same as calling GetFile using that one file)
= Assignment (same as calling GetFileRange using all files)
19

Integer

The integer object is used for values that are numbers without decimal points.
A property or variable is of this type when declared as int. The object has no properties.

Methods

Syntax Description
void Add(int num) Adds num to the current value. The value of this object
real AsReal() Converts and returns the current value of this object as
string AsString() Returns the current value of this object as a string.
void Divide(int num) Divides the current value by num. The value of this
is changed.
Parameters:
num – integer to be added to current value
Returns:
None
a real object. The value of this object is not changed. Parameters:
None
Returns:
A real with the value of this object.
This is typically used so that the value of the integer can be used as part of a string.
Parameters:
None
Returns:
A string with the value of this object.
object is changed.
Parameters:
num – integer to divide by
Returns:
None
void Mod(int num) Divides the current value by num and sets the value of
void Multiply(int num) Multiplies the current value by num. The value of this
this object to the remainder.
Parameters:
num – integer to divide by
Returns:
None
object is changed. Parameters:
num – integer to multiply by
Returns:
None
20

Operators

Symbol Description
<, LT Less Than
>, GT Greater Than
<=, LE Less Than or Equal To
>=, GE Greater Than or Equal To
==, EQ Equals
<>, NE, != Not Equal
+Add
- Subtract
*Multiply
/ Divide
% Modulo (Remainder)
= Assignment
Examples
Statement Value of X Comment
int x 0 Declares variable x = 5 5 Assigns value of 5 to x x.Mod(2) 1 5/2 is 2 with remainder
1 x.Add(9) 10 x.Subtract(2) 8 x.Multiply(2) 16 x.Divide(8) 2 x.AsReal() 2 Returns 2.0 x.AsString() 2 Returns "2"
Note: The standard mathematical operators (+, -, *, /) can also be used.
21
Loading...
+ 173 hidden pages