lotus script language guide

614
Lotus® Domino Designer LotusScript Language Guide Version7 G210-2374-00

Upload: whatevernoidea5191

Post on 20-Feb-2015

695 views

Category:

Documents


39 download

TRANSCRIPT

Lotus Domino Designer

Version7

LotusScript Language Guide

G210-2374-00

Note: Before using this information and the product it supports, read the information in "Notices" at the end of this document.

First Edition (December, 2005) This edition applies to IBM Lotus Domino Designer 7 (product number L-GHUS-5RWNHM), and to all subsequent releases and modifications, until otherwise indicated in new editions. Copyright International Business Machines Corporation 1994, 2005. All rights reserved. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

ContentsChapter 1. Introduction to LotusScript. . 1What is LotusScript? . . . . Advantages of LotusScript . . Working with scripts . . . Working in the script editor Working with Lotus software . Determining which product Debugging applications . . . . . . . . file . . . . . . is . . . . . . . . . . . being . . . . . . . . . . . . used . . . . . . . . . . . . . . . . 1 1 2 3 4 4 5 Dates/Time . . . . Referring to Variants . . . . . . . . . . . . . . . . . . 52 . 54

Chapter 4. Expressions and OperatorsOverview of expressions and operators . LotusScript operators . . . . . . Operator order of precedence . . . . Examples . . . . . . . . . . Table of numeric operators . . . . Arithmetic Operators . . . . . . . Exponentiation operator . . . . . Negation operator . . . . . . . Multiplication operator . . . . . Division operator . . . . . . . Integer division operator . . . . . Mod operator. . . . . . . . . Addition operator . . . . . . . Subtraction operator . . . . . . Relational (comparison) operators . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . . Usage . . . . . . . . . . . String comparison . . . . . . . Data type conversion . . . . . . Examples . . . . . . . . . . Logical Operators . . . . . . . . Bitwise Operators . . . . . . . Boolean Operators . . . . . . . Not operator . . . . . . . . . And operator . . . . . . . . . Or operator . . . . . . . . . Xor operator . . . . . . . . . Eqv operator . . . . . . . . . Imp operator . . . . . . . . . Table of string operators . . . . . . String concatenation operators . . . String relational(comparison) operators Like operator . . . . . . . . . Is operator . . . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Example . . . . . . . . . . IsA operator . . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5757 57 58 58 59 60 61 62 62 63 63 64 64 65 66 66 66 66 67 67 68 68 69 70 71 73 73 74 75 76 77 78 79 80 81 83 83 83 83 84 84 84 84 84 84

Chapter 2. Script and Statement Construction Rules . . . . . . . . . . 7Statement construction rules . . . . . . . . . 7 Example . . . . . . . . . . . . . . . 7 Literal number construction rules . . . . . . . 7 Literal string construction rules . . . . . . . . 8 Identifier construction rules . . . . . . . . . 9 Escape character for illegal identifiers . . . . . 9 Examples . . . . . . . . . . . . . . 9 Labels . . . . . . . . . . . . . . . . 9 Keywords . . . . . . . . . . . . . . . 10 Alphabetical listing of LotusScript keywords . . 10 Special characters . . . . . . . . . . . . 13

Chapter 3. Data Types, Constants, and Variables . . . . . . . . . . . . . . 17Summary of LotusScript data types . Data type conversion . . . . . . Numeric operations . . . . . Argument passing . . . . . . Variant variables . . . . . . . Explicit data type conversion . . Automatic data type conversion . Constants and Variables . . . . . Scope of declarations . . . . . . Name conflicts and shadowing . . Module scope . . . . . . . Procedure scope . . . . . . . Type or class scope . . . . . . Constants . . . . . . . . . . Built-in constants . . . . . . Constants defined in LSCONST.LSS Constants defined in LSPRVAL.LSS Product-specific constants . . . User-defined constants . . . . Variables . . . . . . . . . . Declaring scalar variables explicitly Declaring scalar variables implicitly Examples of scalar variables . . . Arrays . . . . . . . . . . . Fixed arrays . . . . . . . . Dynamic arrays . . . . . . . Lists . . . . . . . . . . . . Working with lists . . . . . . Variants . . . . . . . . . . Boolean values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 18 18 18 18 19 20 22 23 23 23 24 24 25 25 26 26 26 26 29 29 33 34 36 39 43 45 47 49 51

Chapter 5. Procedures: Functions, Subs, and Properties . . . . . . . . 85Procedures . . . . Functions . . . . . Defining functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 . 85 . 86

iii

Passing arguments by reference and by value . . 87 Assigning a return value to a function . . . . 89 Executing a user-defined function . . . . . . 90 Values that a function can manipulate . . . . 93 Subs . . . . . . . . . . . . . . . . . 96 Defining subs. . . . . . . . . . . . . 96 Executing a sub . . . . . . . . . . . . 97 Specialized subs . . . . . . . . . . . . 98 Properties . . . . . . . . . . . . . . . 99 Declaring and defining properties . . . . . . 99 Using properties . . . . . . . . . . . 100

Managing memory for objects . . . . Derived Classes . . . . . . . . . Property and method overriding . . . Arrays and lists of classes . . . . . . Working with object reference variables . Creating objects . . . . . . . . Using the Set statement . . . . . . Using Variants to hold object references Language cross-reference . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

136 137 139 143 144 144 145 146 146

Chapter 9. Managing Flow in ScriptsFlow of execution . . . . . . . . . . . Flow control statements . . . . . . . . Comments and the compiler directive . . . Declarations . . . . . . . . . . . . Definition statements . . . . . . . . . Errors . . . . . . . . . . . . . . Statement labels . . . . . . . . . . Block statements . . . . . . . . . . . Selecting one or the other with the If...Then...Else statement . . . . . . . . Specifying multiple test conditions with the If...Then...ElseIf statement . . . . . . . Making a choice with the Select Case statement Branching statements . . . . . . . . . . Transferring control with the GoTo statement Using the If...GoTo...Else statement to transfer unconditionally . . . . . . . . . . . Conditional control transfer with the On...GoTo statement . . . . . . . . . . . . . Transferring control within the same procedure with the GoSub, On...GoSub, and Return statements . . . . . . . . . . . . Iterative statements . . . . . . . . . . Do and Do...While loops . . . . . . . For...Next loops . . . . . . . . . . ForAll loops for lists and arrays . . . . . Using the While statement . . . . . . . Early termination statements . . . . . . . Stopping procedure execution early using the End statement . . . . . . . . . . . Using the Exit statement for early procedure termination . . . . . . . . . . . .

147. . . . . . . . 147 147 147 147 148 148 148 148

Chapter 6. File Handling . . . . . . . 103File operations . . . . . . . . . . Sequential files . . . . . . . . . . Opening sequential files . . . . . . Writing to sequential files . . . . . Reading from sequential files . . . . Random files . . . . . . . . . . Opening random files . . . . . . Defining record types . . . . . . Writing to random files in LotusScript . Reading from random files . . . . . Binary files . . . . . . . . . . . Opening binary files . . . . . . . Using variable-length fields . . . . Writing to binary files . . . . . . Reading from binary files . . . . . Reading, writing, and closing files . . . Opening files . . . . . . . . . Reading from files and writing to them. Closing files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 103 103 104 104 105 105 105 106 106 107 107 107 107 107 108 109 109 111

. 148 . 150 152 . 153 153 . 154 . 154

Chapter 7. Error Processing . . . . . 113Types of errors . . . . . . . . . . Run-time error processing . . . . . . Informational functions used in run-time Statements used in run-time errors . . . . . 113 . . . 113 errors 113 . . . 116

. . . . . . .

155 157 157 159 163 167 167

Chapter 8. User-Defined Data Types and Classes . . . . . . . . . . . . 125Overview of user-defined data types and classes User-defined data types . . . . . . . . . . Declaring a variable of a user-defined data type Referring to member variables . . . . . . . Conserving memory when declaring member variables . . . . . . . . . . . . . . Working with data stored in files . . . . . . User-defined classes . . . . . . . . . . . Benefits of classes . . . . . . . . . . . Base classes . . . . . . . . . . . . . . Declaring member variables . . . . . . . Defining member properties and methods . . . Public and Private class members . . . . . Private class members . . . . . . . . . Initializing member variables . . . . . . . Public class members . . . . . . . . . . Referring to members of an object . . . . . Testing object references . . . . . . . . . Deleting objects . . . . . . . . . . . 125 126 126 127 127 128 129 129 130 130 130 133 133 133 134 134 135 136

. 167 . 168

Chapter 10. Managing Asynchronous Web Agents in Domino . . . . . . . 171Introduction to multithreading and synchronization in LotusScript . . . . . . . . . . . . . Advantages of thread-safe agents . . . . . . . Agents run serially . . . . . . . . . . Threaded agents . . . . . . . . . . . Synchronization functions . . . . . . . . . How synchronization works . . . . . . . . Running asynchronous agents on the Domino server . . . . . . . . . . . . . . . . Thread-safe LSX, C/C++ code . . . . . . . Thread-specific bugs . . . . . . . . . . Creating and destroying locks . . . . . . . 171 171 171 172 172 172 175 175 175 175

Chapter 11. Beyond Core LotusScript

177

iv

LotusScript Language Guide

Lotus software environments . . . . . . . . Determining which product file is being used Product classes and objects . . . . . . . . Interacting with the user . . . . . . . . . MsgBox on Notes server context . . . . . . Interacting with other programs . . . . . . . Functions and statements for working with other programs . . . . . . . . . . . . OLE Automation . . . . . . . . . . . Calling external C language functions . . . . . Example . . . . . . . . . . . . . . Declaring C functions . . . . . . . . . Passing arguments to C functions . . . . . Passing strings . . . . . . . . . . . . Passing arrays, types, and objects. . . . . . Using user-defined data type variables . . . . Return values . . . . . . . . . . . . Calling C language functions extended example LS2J: Connecting with Java . . . . . . . . . About LS2J . . . . . . . . . . . . . System requirements . . . . . . . . . . Using LS2J . . . . . . . . . . . . . LS2J classes . . . . . . . . . . . . . Data type mappings . . . . . . . . . . LS2J extended example . . . . . . . . .

177 177 177 180 182 182 182 184 185 186 186 187 188 190 192 193 194 195 195 195 195 200 225 227

Chapter 12. LotusScript Language Reference . . . . . . . . . . . . . 233Abs function . . . . . . . . . . . . . 233 Syntax . . . . . . . . . . . . . . . 233 Elements . . . . . . . . . . . . . . 233 Return value . . . . . . . . . . . . 233 Usage . . . . . . . . . . . . . . . 233 Language cross-reference . . . . . . . . 233 Examples: Abs function . . . . . . . . . 233 ACos function . . . . . . . . . . . . . 233 Syntax . . . . . . . . . . . . . . . 234 Elements . . . . . . . . . . . . . . 234 Return value . . . . . . . . . . . . 234 Usage . . . . . . . . . . . . . . . 234 Language cross-reference . . . . . . . . 234 Examples: ACos function . . . . . . . . 234 ActivateApp statement . . . . . . . . . . 234 Syntax . . . . . . . . . . . . . . . 234 Elements . . . . . . . . . . . . . . 234 Usage . . . . . . . . . . . . . . . 234 Examples: ActivateApp statement . . . . . 235 ArrayAppend function . . . . . . . . . . 235 Syntax . . . . . . . . . . . . . . . 235 Elements . . . . . . . . . . . . . . 235 Return value . . . . . . . . . . . . 235 Usage . . . . . . . . . . . . . . . 235 Error handling . . . . . . . . . . . . 235 Extended examples: array and String functions 236 ArrayGetIndex function . . . . . . . . . . 239 Syntax . . . . . . . . . . . . . . . 239 Elements . . . . . . . . . . . . . . 239 Return value . . . . . . . . . . . . 239 Usage . . . . . . . . . . . . . . . 239 ArrayReplace function . . . . . . . . . . 240 Syntax . . . . . . . . . . . . . . . 240

Elements . . . . . . . . . Return value . . . . . . . Usage . . . . . . . . . . ArrayUnique function . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Usage . . . . . . . . . . Language cross-reference . . . Examples: ArrayUnique function . Asc function . . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Examples: Asc function . . . . ASin function . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Language cross-reference . . . Examples: ASin function. . . . ATn function . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Language cross-reference . . . Examples: ATn function . . . . ATn2 function . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Language cross-reference . . . Examples: ATn2 function . . . Beep statement . . . . . . . . Syntax . . . . . . . . . . Usage . . . . . . . . . . Examples: Beep statement . . . Bin function . . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Usage . . . . . . . . . . Examples: Bin function . . . . Boolean data type . . . . . . . Usage . . . . . . . . . . Examples: Boolean data type . . Bracket notation . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Usage . . . . . . . . . . Examples: Bracket notation . . . Byte data type . . . . . . . . Usage . . . . . . . . . . Examples: Byte data type . . . Call statement . . . . . . . . Syntax 1 . . . . . . . . . Syntax 2 . . . . . . . . . Syntax 3 . . . . . . . . . Syntax 4 (functions only) . . . Elements . . . . . . . . . Usage . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

240 240 240 242 242 242 242 243 243 243 243 243 244 244 244 244 244 244 244 244 244 245 245 245 245 245 245 245 245 245 245 246 246 246 246 246 246 247 247 247 247 247 247 247 247 248 248 248 248 248 249 249 249 249 250 250 250 250 250 250 251

Contents

v

Referencing a function that returns an array, list, or collection . . . . . . . . . . Examples: Call statement . . . . . . . CBool function . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Examples: CBool function . . . . . . . CByte function . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Examples: CByte function . . . . . . . CCur function . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Examples: CCur function . . . . . . . CDat function . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Usage . . . . . . . . . . . . . . Language cross-reference . . . . . . . Examples: CDat function . . . . . . . CDbl function . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Language cross-reference . . . . . . . Examples: CDbl function . . . . . . . ChDir statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: ChDir statement . . . . . . . ChDrive statement . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: ChDrive statement . . . . . . Chr function. . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Chr function . . . . . . . . CInt function . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Language cross-reference . . . . . . . Examples: CInt function . . . . . . . . Class statement . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Class statement . . . . . . . CLng function . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

251 251 252 252 252 252 252 253 253 253 253 253 254 254 254 254 254 255 255 255 255 255 256 256 256 256 256 256 256 257 257 257 257 257 258 258 258 258 258 258 258 258 258 259 259 259 259 259 260 260 260 260 260 260 261 261 262 263 263 263

Return value . . . . . . . Language cross-reference . . . Examples: CLng function . . . Close statement . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Usage . . . . . . . . . . Examples: Close statement . . . CodeLock function . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return values . . . . . . . Usage . . . . . . . . . . Extended examples: lock functions CodeLockCheck function . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return values . . . . . . . Usage . . . . . . . . . . CodeUnlock function . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return values . . . . . . . Usage . . . . . . . . . . Command function . . . . . . Syntax . . . . . . . . . . Return value . . . . . . . Usage . . . . . . . . . . Examples: Command function . . Const statement . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Functions that can be evaluated as constants . . . . . . . . . Usage . . . . . . . . . . Examples: Const statement . . . Cos function . . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Language cross-reference . . . Examples: Cos function . . . . CreateLock function . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return values . . . . . . . Usage . . . . . . . . . . CreateObject function. . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Usage . . . . . . . . . . Examples: CreateObject function . CSng function . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Language cross-reference . . . Examples: CSng function . . . CStr function . . . . . . . . Syntax . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LotusScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

263 263 263 264 264 264 264 264 264 264 264 264 265 265 266 266 266 266 266 266 266 266 266 267 267 267 267 267 267 267 267 267 268 268 269 269 269 269 269 270 270 270 270 270 270 270 270 270 270 271 271 272 272 272 272 272 272 272 273 273

vi

LotusScript Language Guide

Return value . . . . . . Language cross-reference . . Examples: CStr function . . . CurDir function . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Language cross-reference . . Examples: CurDir function . . CurDrive function . . . . . . Syntax . . . . . . . . . Return value . . . . . . Examples: CurDrive function . Currency data type . . . . . Usage . . . . . . . . . Examples: Currency data type . CVar function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Examples: CVar function . . DataType function . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Language cross-reference . . Examples: DataType function . About data types . . . . . Date function . . . . . . . Syntax . . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Examples: Date function . . . Date statement . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Usage . . . . . . . . . Examples: Date statement . . DateNumber function . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Language cross-reference . . Examples: DateNumber function DateValue function . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Language cross-reference . . Examples: DateValue function . Day function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Language cross-reference . . Examples: Day function . . . Declare statement (external C calls) Syntax . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

273 273 273 273 273 273 274 274 274 274 274 274 274 274 274 275 275 275 275 275 275 275 276 276 276 276 276 277 277 277 278 278 278 278 279 279 279 279 279 279 279 279 280 280 280 280 280 280 281 281 281 281 281 281 281 281 282 282 282 282 282

Elements . . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . . Passing arguments . . . . . . . . . . Using LMBCS or Unicode strings . . . . . . Calling exported library functions in 32-bit versions of Windows . . . . . . . . . . Examples: Declare statement (external C calls) Declare statement (forward reference) . . . . . Syntax . . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . . Examples: Declare statement (forward reference) Deftypestatements . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . . Examples: Deftype statements . . . . . . . Delete statement . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . . Examples: Delete statement . . . . . . . . DestroyLock function . . . . . . . . . . . Syntax . . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . . Return values . . . . . . . . . . . . Usage . . . . . . . . . . . . . . . Dim statement . . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . . Explicit declarations and implicit declarations Specifying the data type . . . . . . . . . Declaring arrays . . . . . . . . . . . Declaring lists . . . . . . . . . . . . Declaring object reference variables . . . . . Initializing variables . . . . . . . . . . Visibility of declarations . . . . . . . . . Examples: Dim statement . . . . . . . . Dir function . . . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . . Return value . . . . . . . . . . . . Usage . . . . . . . . . . . . . . . Examples: Dir function . . . . . . . . . Do statement . . . . . . . . . . . . . Syntax 1 . . . . . . . . . . . . . . Syntax 2 . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . . Terminating the loop . . . . . . . . . . Language cross-reference . . . . . . . . Examples: Do statement . . . . . . . . . Dot notation . . . . . . . . . . . . . . Syntax 1 . . . . . . . . . . . . . . Syntax 2 . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . . Examples: Dot notation . . . . . . . . . Double data type . . . . . . . . . . . . Usage . . . . . . . . . . . . . . .Contents

282 284 284 284 285 285 285 285 285 287 287 287 287 288 288 289 289 289 289 289 289 290 290 290 290 290 290 290 291 292 292 292 292 293 293 293 293 294 295 295 295 296 296 296 296 296 296 297 297 297 297 297 297 297 298 298 298 298 298 298

vii

Examples: Double data type . . . . . End statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Language cross-reference . . . . . . Examples: End statement . . . . . . Environ function . . . . . . . . . . Syntax 1 . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Language cross-reference . . . . . . Examples: Environ function . . . . . EOF function . . . . . . . . . . . Syntax . . . . . . . . . . . . . Return value . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: EOF function . . . . . . . Erase statement. . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: Erase statement . . . . . . Erl function . . . . . . . . . . . . Syntax . . . . . . . . . . . . . Return value . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: Erl function . . . . . . . Err function . . . . . . . . . . . . Syntax . . . . . . . . . . . . . Return value . . . . . . . . . . Usage . . . . . . . . . . . . . Language cross-reference . . . . . . Examples: Err function . . . . . . . Err statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: Err statement . . . . . . . Error function . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Language cross-reference . . . . . . Examples: Error function . . . . . . Error statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: Error statement . . . . . . Evaluate function and statement . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Examples: Evaluate function and statement Execute function and statement . . . . . Statement Syntax . . . . . . . . . Function Syntax . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Usage . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

299 299 299 299 299 299 299 299 299 300 300 300 300 300 300 301 301 301 301 301 301 302 302 302 302 302 302 302 303 303 303 303 303 303 304 304 304 304 304 304 304 304 305 305 305 305 305 305 306 306 306 306 307 307 307 307 307 307 307 308 308

Examples: Execute function and statement. Exit statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Language cross-reference . . . . . . Examples: Exit statement . . . . . . Exp function . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Usage . . . . . . . . . . . . . Language cross-reference . . . . . . Examples: Exp function . . . . . . . FileAttr function . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Examples: FileAttr function . . . . . . FileCopy statement . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: FileCopy statement . . . . . FileDateTime function . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Examples: FileDateTime function . . . . FileLen function . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Examples: FileLen function . . . . . . Fix function . . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: Fix function . . . . . . . For statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Executing the loop the first time . . . . Executing the loop more than once . . . Exiting the loop early . . . . . . . Nested For loops . . . . . . . . . Language cross-reference . . . . . . Examples: For statement . . . . . . . ForAll statement . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Exiting the loop early . . . . . . . Using refVar . . . . . . . . . . . Language cross-reference . . . . . . Examples: ForAll statement. . . . . . Format function . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

308 309 309 309 309 310 310 310 310 310 310 311 311 311 311 311 311 311 311 312 312 312 312 312 312 312 313 313 313 313 313 313 313 313 313 313 314 314 314 314 314 315 315 315 315 315 315 315 316 316 316 316 316 317 317 317 317 318 319 319 319

viii

LotusScript Language Guide

Return value . . . . . . . . . . . Formatting codes . . . . . . . . . . Numeric formats . . . . . . . . . . Named numeric formats . . . . . . . . Custom numeric formatting codes . . . . Date/time formats. . . . . . . . . . Named date/time formats . . . . . . . Custom date/time formatting codes . . . . String formatting codes . . . . . . . . Formatting dates and times in Asian languages Date/time format codes . . . . . . . . Examples: Format function . . . . . . . Fraction function . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Fraction function . . . . . . FreeFile function . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Return value . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: FreeFile function . . . . . . FullTrim function . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Element . . . . . . . . . . . . . Return value . . . . . . . . . . . Usage . . . . . . . . . . . . . . Function statement . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Function statement . . . . . . Get statement . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Get statement . . . . . . . GetFileAttr function . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: GetFileAttr function . . . . . GetObject function . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: GetObject function . . . . . . GetThreadInfo function . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return values . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: GetThreadInfo function . . . . GoSub statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: GoSub statement . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

319 319 319 319 320 321 321 322 323 324 324 325 327 327 327 327 327 327 327 327 327 328 328 328 328 328 328 328 329 329 329 330 330 331 332 332 332 333 334 334 334 334 334 334 335 335 335 335 335 336 337 337 337 337 337 338 338 338 338 338 338

GoTo statement . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Examples: GoTo statement . . . . Hex function . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Usage . . . . . . . . . . . Examples: Hex function . . . . . Hour function . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Language cross-reference . . . . Examples: Hour function . . . . If...GoTo statement . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Language cross-reference . . . . Examples: If...GoTo statement . . . If...Then...Else statement . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Language cross-reference . . . . Examples: If...Then...Else statement . If...Then...ElseIf statement . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Language cross-reference . . . . Examples: If...Then...ElseIf statement %If directive . . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Examples: %If directive . . . . . IMESetMode function . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return values . . . . . . . . Usage . . . . . . . . . . . Examples: IMESetMode . . . . . IMEStatus function . . . . . . . Syntax . . . . . . . . . . . Return value . . . . . . . . Usage . . . . . . . . . . . Example . . . . . . . . . . Implode function . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Usage . . . . . . . . . . . Error handling . . . . . . . . Examples: Implode function . . . %Include directive . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

339 339 339 339 339 340 340 340 340 340 340 340 340 341 341 341 341 341 341 341 342 342 342 342 343 343 343 343 343 343 343 344 344 344 344 344 344 345 345 346 347 347 347 348 348 348 348 348 348 348 349 349 349 349 349 350 350 350 350 350 350

Contents

ix

Usage . . . . . . . . Examples: %Include directive Input # statement . . . . . Syntax . . . . . . . . Elements . . . . . . . Usage . . . . . . . . Examples: Input # statement Input function . . . . . . Syntax . . . . . . . . Elements . . . . . . . Return value . . . . . Usage . . . . . . . . Examples: Input function . InputB function . . . . . Syntax . . . . . . . . Return value . . . . . Usage . . . . . . . . Examples: InputB function . InputBox function . . . . . Syntax . . . . . . . . Elements . . . . . . . Return value . . . . . Usage . . . . . . . . Language cross-reference . Examples: InputBox function InputBP function . . . . . Syntax . . . . . . . . Return value . . . . . Usage . . . . . . . . Examples: InputBP function InStr function . . . . . . Syntax . . . . . . . . Elements . . . . . . . Return value . . . . . Usage . . . . . . . . Language cross-reference . Examples: InStr function . InStrB function . . . . . . Syntax . . . . . . . . Elements . . . . . . . Return value . . . . . Usage . . . . . . . . Examples: InStrB function . InStrBP function . . . . . Syntax . . . . . . . . Elements . . . . . . . Return value . . . . . Usage . . . . . . . . Examples: InStrBP function . InStrC function . . . . . . Syntax . . . . . . . . Elements . . . . . . . Return value . . . . . Usage . . . . . . . . Int function . . . . . . . Syntax . . . . . . . . Elements . . . . . . . Return value . . . . . Usage . . . . . . . . Examples: Int function . . Integer data type . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

351 351 351 351 351 352 353 353 353 354 354 354 354 354 354 355 355 355 355 355 355 356 356 356 356 356 357 357 357 357 357 357 357 358 358 358 359 359 359 359 359 360 360 360 360 360 360 361 361 361 361 361 361 361 362 362 362 362 362 362 362

Usage . . . . . . . . . Examples: Integer data type . IsArray function . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Examples: IsArray function . . IsDate function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Examples: IsDate function . . IsDefined function . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Examples: IsDefined function . IsElement function . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Examples: IsElement function . IsEmpty function . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Examples: IsEmpty function . IsList function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Examples: IsList function . . IsNull function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Language cross-reference . . Examples: IsNull function . . IsNumeric function . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Language cross-reference . . Examples: IsNumeric function . IsObject function . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Examples: IsObject function . IsScalar function . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Examples: IsScalar function . . IsUnknown function . . . . . Syntax . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

362 363 363 363 363 363 363 363 363 363 363 364 364 364 364 364 364 364 365 365 365 365 366 366 366 367 367 367 367 367 367 367 367 367 368 368 368 368 368 368 368 368 368 368 369 369 369 369 369 370 370 370 370 370 370 370 370 370 371 371 371

x

LotusScript Language Guide

Elements . . . . . . . . Return value . . . . . . Examples: IsUnknown function Join function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Error handling . . . . . . Language cross-reference . . Examples: Join function . . . Kill statement . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Usage . . . . . . . . . Example: Kill statement . . . LBound function . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Example: LBound function . . LCase function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Example: LCase function . . Left function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Example: Left function . . . LeftB function . . . . . . . LeftBP function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Example: LeftBP function . . LeftC function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Example: LeftC function . . . Len function . . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Examples: Len function . . . LenB function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Examples: LenB function . . LenBP function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

371 371 371 372 372 372 372 372 372 372 373 373 373 373 373 373 373 373 373 373 373 374 374 374 374 374 374 374 374 374 374 374 375 375 375 375 375 375 375 376 376 376 376 376 376 376 376 376 377 377 377 377 378 378 378 378 378 379 379 379 379

Usage . . . . . . . . . . . LenC function . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Usage . . . . . . . . . . . Let statement . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Example: Let statement . . . . . Line Input # statement . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Example: Line Input # statement . . ListTag function . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Usage . . . . . . . . . . . Example: ListTag function . . . . LOC function . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Example: LOC function . . . . . Lock and Unlock statements . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Example: Lock and unlock statements LOF function . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Usage . . . . . . . . . . . Example: LOF function . . . . . Log function . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Usage . . . . . . . . . . . Example: Log function . . . . . Long data type . . . . . . . . . Usage . . . . . . . . . . . Example: Long data type . . . . LSet statement . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Example: LSet statement. . . . . LTrim function . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Example: LTrim function . . . . MessageBox function and statement . . Function Syntax . . . . . . . Statement Syntax . . . . . . . Elements . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

379 379 380 380 380 380 380 380 380 381 381 381 381 382 382 382 382 382 382 382 382 383 383 383 383 383 383 384 384 384 384 384 385 385 385 385 385 385 386 386 386 386 386 386 386 386 386 387 387 387 387 387 387 387 388 388 388 388 388 388 388

Contents

xi

Return value . . . . . . . . Usage . . . . . . . . . . . Examples: MessageBox function and Mid function . . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Language cross-reference . . . . Examples: Mid function . . . . . Mid statement . . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Language cross-reference . . . . Examples: Mid statement . . . . MidB function . . . . . . . . . MidB statement . . . . . . . . MidBP function. . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Examples: MidBP function . . . . MidC function . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Usage . . . . . . . . . . . Minute function . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Language cross-reference . . . . Examples: Minute function . . . MkDir statement . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Examples: MkDir statement . . . Month function . . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Language cross-reference . . . . Examples: Month function . . . . Name statement . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . . Usage . . . . . . . . . . . Examples: Name statement . . . Now function . . . . . . . . . Syntax . . . . . . . . . . Return value . . . . . . . . Usage . . . . . . . . . . . Language cross-reference . . . . Examples: Now function . . . . Oct function . . . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . . Return value . . . . . . . . Usage . . . . . . . . . . . Examples: Oct function . . . . .

. . . . . . . . statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

389 390 390 391 391 391 391 391 391 391 391 391 392 392 392 392 392 392 393 393 393 393 393 393 393 394 394 394 394 394 394 394 394 395 395 395 395 395 395 395 395 396 396 396 396 396 396 396 397 397 397 397 397 397 397 397 397 397 397 398 398

On Error statement . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . How does On Error work? . . . . . . . How does the error-handling routine work? Where are error numbers and messages defined? . . . . . . . . . . . . . Language cross-reference . . . . . . . Examples: On Error statement . . . . . On Event statement . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: On Event statement . . . . . On...GoSub statement . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: On...GoSub statement . . . . On...GoTo statement . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: On...GoTo statement . . . . . Open statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Open statement . . . . . . . Option Base statement . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Option Base statement . . . . Option Compare statement . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Option Compare statement . . . Option Declare statement . . . . . . . . Syntax . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Option Declare statement . . . Option Public statement . . . . . . . . . Syntax . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Option Public statement . . . . Print statement . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Print statement . . . . . . . Print # statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Print # statement . . . . . . Property Get/Set statements . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . .

. . . . .

398 398 398 398 399 399 399 399 399 400 400 400 401 401 401 401 401 402 402 402 402 402 403 403 403 404 404 406 406 407 407 407 407 407 407 407 408 408 408 409 409 409 410 410 410 410 410 410 410 411 411 412 412 412 412 413 413 413 414 415

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

xii

LotusScript Language Guide

Using Property Get . . . . . . . . . Using Property Set . . . . . . . . . Referencing a property that returns an array, list, or collection . . . . . . . . . . Passing a property to a function . . . . . Examples: Property Get/Set statements . . Put statement . . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Put statement . . . . . . . Randomize statement . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Randomize statement . . . . . ReDim statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: ReDim statement . . . . . . Rem statement . . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Language cross-reference . . . . . . . Examples: Rem statement . . . . . . . %Rem directive. . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Language cross-reference . . . . . . . Examples: %Rem directive . . . . . . . Replace function . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Usage . . . . . . . . . . . . . . Language cross-reference . . . . . . . Examples: Replace function . . . . . . . Reset statement . . . . . . . . . . . . Syntax . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Reset statement . . . . . . . Resume statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Resume statement . . . . . . Return statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Return statement . . . . . . Right function . . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . . Return value . . . . . . . . . . . Usage . . . . . . . . . . . . . . Language cross-reference . . . . . . . Examples: Right function . . . . . . . RightB function. . . . . . . . . . . .

. 415 . 415 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 416 416 416 417 417 417 418 419 419 419 419 419 419 420 420 420 421 421 421 422 422 422 422 422 422 422 422 423 423 423 423 423 424 424 425 425 425 425 425 425 426 426 426 426 426 427 427 427 427 427 427 428 428 428 428 428 428

RightBP function . . . . . Syntax . . . . . . . . Elements . . . . . . . Return value . . . . . Language cross-reference . Examples: RightBP function RightC function . . . . . Syntax . . . . . . . . Elements . . . . . . . Return value . . . . . Usage . . . . . . . . Examples: RightC function . RmDir statement . . . . . Syntax . . . . . . . Elements . . . . . . . Usage . . . . . . . . Examples: RmDir statement Rnd function . . . . . . Syntax . . . . . . . Elements . . . . . . . Return value . . . . . Usage . . . . . . . . Language cross-reference . Examples: Rnd function . Round function . . . . . . Syntax . . . . . . . Elements . . . . . . . Return value . . . . . Language cross-reference . Examples: Round function . RSet statement . . . . . . Syntax . . . . . . . Elements . . . . . . . Usage . . . . . . . . Examples: RSet statement . RTrim function . . . . . . Syntax . . . . . . . Elements . . . . . . . Return value . . . . . Examples: RTrim function . Run statement . . . . . . Second function . . . . . Syntax . . . . . . . Elements . . . . . . . Return value . . . . . Language cross-reference . Examples: Second function . Seek function . . . . . . Syntax . . . . . . . Elements . . . . . . . Return value . . . . . Usage . . . . . . . . Examples: Seek function . Seek statement . . . . . . Syntax . . . . . . . Elements . . . . . . . Usage . . . . . . . . Examples: Seek statement . Select Case statement . . . . Syntax . . . . . . . Elements . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

428 428 428 429 429 429 429 429 429 429 429 429 430 430 430 430 430 430 430 430 430 430 431 431 431 431 431 431 432 432 432 432 432 432 432 433 433 433 433 433 433 433 433 433 434 434 434 434 434 434 434 435 435 435 435 435 436 436 436 436 437

Contents

xiii

Usage . . . . . . . . . . . . . Examples: Select Case statement . . . . SendKeys statement . . . . . . . . . Syntax . . . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: SendKeys statement . . . . Set statement . . . . . . . . . . . Syntax 1: Create an object and assign a reference . . . . . . . . . . . . Elements . . . . . . . . . . . . Syntax 2: Copy an existing object reference another variable . . . . . . . . . Elements . . . . . . . . . . . . Syntax 3: Associate a product object with a variable . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Language cross-reference . . . . . . Examples: Set statement . . . . . . . SetFileAttr statement . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: SetFileAttr statement . . . . Sgn function . . . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Language cross-reference . . . . . . Examples: Sgn function . . . . . . . Shell function . . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Usage . . . . . . . . . . . . . Language cross-reference . . . . . . Examples: Shell function . . . . . . Shellid function . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: Shellid function . . . . . . Sin function . . . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Language cross-reference . . . . . . Examples: Sin function . . . . . . . Single data type . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: Single data type . . . . . . Sleep statement . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: Sleep statement . . . . . . Space function . . . . . . . . . . . Syntax . . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . .

. . . . . . . . . to . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . .

437 437 438 438 438 440 440

. 440 . 440 . 440 . 441 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441 441 441 442 442 442 442 442 443 443 443 443 443 444 444 444 444 444 444 445 445 445 445 445 445 445 446 446 446 446 446 447 447 447 447 447 447 447 447 447 447 448 448 448 448 448 448

Examples: Space function . . Spc function . . . . . . . . Syntax . . . . . . . . Elements . . . . . . . . Usage . . . . . . . . . Examples: Spc function . . . Split function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Error Handling: . . . . . Language cross-reference . . Examples: Split function . . . Sqr function . . . . . . . . Syntax . . . . . . . . Elements . . . . . . . . Return value . . . . . . Language cross-reference . . Examples: Sqr function . . . Stop statement . . . . . . . Syntax . . . . . . . . . Usage . . . . . . . . . Str function . . . . . . . . Syntax . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Language cross-reference . . Examples: Str function . . . StrCompare function . . . . . Syntax . . . . . . . . Elements . . . . . . . . Return value . . . . . . Language cross-reference . . Examples: StrCompare function StrConv function . . . . . . Syntax . . . . . . . . Elements . . . . . . . . Return value . . . . . . Usage . . . . . . . . . Language cross-reference . . Examples: StrConv function . StrLeft function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Language cross-reference . . StrLeftBack function . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Language cross-reference . . StrRight function . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . Language cross-reference . . StrRightBack function . . . . Syntax . . . . . . . . . Elements . . . . . . . . Language cross-reference . . StrToken function . . . . . . Syntax . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

448 448 448 448 449 449 449 449 449 450 450 450 450 451 451 451 451 451 451 451 451 451 451 452 452 452 452 452 452 452 452 453 453 453 453 453 454 454 454 454 455 455 455 455 455 455 456 456 456 456 457 457 457 457 457 457 457 458 458 458 458

xiv

LotusScript Language Guide

Elements . . . . . . . Return value . . . . . Usage . . . . . . . . Error Handling . . . . . Language cross-reference . Examples: StrToken function String data type . . . . . Usage . . . . . . . . Examples: String data type . String function . . . . . . Syntax . . . . . . . Elements . . . . . . . Return value . . . . . Examples: String function . Sub statement . . . . . . Syntax . . . . . . . Elements . . . . . . . Usage . . . . . . . . Examples: Sub statement . Sub Delete . . . . . . . Syntax . . . . . . . . Usage . . . . . . . . Examples: Sub Delete. . . Sub Initialize . . . . . . Syntax . . . . . . . . Usage . . . . . . . . Examples: Sub Initialize . . Sub New . . . . . . . . Syntax . . . . . . . . Elements . . . . . . . Usage . . . . . . . . Examples: Sub New . . . Sub Terminate . . . . . . Syntax . . . . . . . Usage . . . . . . . . Examples: Sub Terminate . Tab function . . . . . . . Syntax . . . . . . . Elements . . . . . . . Usage . . . . . . . . Language cross-reference . Examples: Tab function . . Tan function . . . . . . . Syntax . . . . . . . Elements . . . . . . . Return value . . . . . Language cross-reference . Examples: Tan function . . Time function . . . . . . Syntax . . . . . . . Return value . . . . . Usage . . . . . . . . Examples: Time function . Time statement . . . . . . Elements . . . . . . . Examples: Time statement . TimeNumber function . . . Syntax . . . . . . . Elements . . . . . . . Return value . . . . . Usage . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

458 459 459 459 459 459 460 460 460 460 460 461 461 461 461 461 461 462 462 463 464 464 464 464 465 465 465 465 465 465 466 466 467 467 467 467 468 468 468 468 468 468 469 469 469 469 469 469 469 469 469 469 470 470 470 470 470 470 470 470 470

Examples: TimeNumber function Timer function . . . . . . . . Syntax . . . . . . . . . Return value . . . . . . . Usage . . . . . . . . . . Examples: Timer function . . . TimeValue function . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Usage . . . . . . . . . . Language cross-reference . . . Examples: TimeValue function . Today function . . . . . . . . Syntax . . . . . . . . . Return value . . . . . . . Usage . . . . . . . . . . Language cross-reference . . . Examples: Today function . . . Trim function . . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Language cross-reference . . . Examples: Trim function . . . Type statement . . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . . Usage . . . . . . . . . . Defining types . . . . . . . Declaring type members . . . Declaring a type variable . . . Referring to type members . . Examples: Type statement . . . TypeName function . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Language cross-reference . . . Examples: TypeName function . UBound function . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Usage . . . . . . . . . . Examples: UBound function . . UCase function . . . . . . . . Syntax . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Usage . . . . . . . . . . Language cross-reference . . . Examples: UCase function . . . UChr function . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . . Return value . . . . . . . Examples: UChr function . . . Uni function . . . . . . . . . Syntax . . . . . . . . . . Elements . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

471 471 471 471 471 471 471 471 471 471 472 472 472 472 472 472 472 472 472 472 472 473 473 473 473 473 473 473 474 474 474 474 474 475 475 476 476 476 476 477 477 477 477 477 478 478 478 478 478 478 478 478 478 478 479 479 479 479 479 479 479

Contents

xv

Return value . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: Uni function . . . . . . . Unlock statement . . . . . . . . . . Use statement . . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Loading a used module . . . . . . . Referring to Public names in a used module Declaring Public names . . . . . . . Examples: Use statement . . . . . . UseLSX statement . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: UseLSX statement . . . . . UString function . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Usage . . . . . . . . . . . . . Language cross-reference . . . . . . Examples: UString function . . . . . Val function . . . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Usage . . . . . . . . . . . . . Language cross-reference . . . . . . Examples: Val function . . . . . . . Variant data type . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: Variant data type . . . . . Weekday function . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Return value . . . . . . . . . . Usage . . . . . . . . . . . . . Language cross-reference . . . . . . Examples: Weekday function . . . . . While statement . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Language cross-reference . . . . . . Examples: While statement . . . . . Width # statement . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: Width # statement . . . . . With statement . . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . . Examples: With statement . . . . . . Write # statement . . . . . . . . . . Syntax . . . . . . . . . . . . Elements . . . . . . . . . . . . Usage . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

479 479 479 479 480 480 480 480 480 480 480 480 480 480 481 481 481 482 482 482 482 482 482 482 482 482 482 483 483 483 483 483 483 484 485 485 485 485 485 485 485 485 485 486 486 486 486 486 486 486 487 487 487 487 487 488 488 488 488 488 489

Examples: Write # statement . . . . Year function . . . . . . . . . . Syntax . . . . . . . . . . . Elements . . . . . . . . . . . Return value . . . . . . . . . Language cross-reference . . . . . Examples: Year function . . . . . Yield function and statement . . . . . Syntax . . . . . . . . . . . Return value . . . . . . . . . Usage . . . . . . . . . . . . Examples: Yield function and statement

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

489 490 490 490 490 490 491 491 491 491 491 491

Appendix A Language and Script Limits . . . . . . . . . . . . 493Limits on numeric data representation in LotusScript . . . . . . . . . . . . . . Limits on string data representation in LotusScript Limits on array variables in LotusScript . . . . Limits on file operations in LotusScript . . . . . Limits in miscellaneous source language statements in LotusScript . . . . . . . . . . . . . Limits on compiler and compiled program structure in LotusScript . . . . . . . . . . Storage size of data . . . . . . . . . . 493 493 494 494 494 495 495

Appendix B Platform Differences . . . . . . . . . . . . 497OS/2 platform differences in LotusScript . . Language construct differences . . . . File system differences . . . . . . . Other differences . . . . . . . . . UNIX platform differences in LotusScript . . Language construct differences . . . . File system differences . . . . . . . Other differences . . . . . . . . . Macintosh platform differences in LotusScript Language construct differences . . . . File system differences . . . . . . . Other differences . . . . . . . . . OS/400 platform differences in LotusScript . Language construct differences . . . . File system differences . . . . . . . Other differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 497 497 497 498 498 499 499 500 500 500 501 501 501 502 502

Appendix C LotusScript/REXX Integration . . . . 505 Appendix D LotusScript Aliases . . . . . . . . . . . . . . 507 Appendix E MIME Charset Names . . . . . . . . . . . . . . 509 Appendix F Compile-time Error Messages . . . . . . . . . . 511DELETE not valid on: . Too many nested INCLUDEs . . . . . . . . . . . . . . 511 . 511

xvi

LotusScript Language Guide

File contains too many source lines . . . . . . Illegal OPTION BASE after array declaration . . . Illegal OPTION DECLARE after implicit declaration . . . . . . . . . . . . . . Too many items specified in input/output statement . . . . . . . . . . . . . . . Illegal value for OPTION BASE . . . . . . . Too many labels specified in ON...GOTO statement SUB NEW arguments do not match parents SUB NEW arguments . . . . . . . . . . . . Name previously declared: . . . . . . Class is not a parent of this class: . . Illegal name for class or type: . . . . . Public symbol is declared in another module: . . . . . . . . . . . . . . . Member is not a subprogram: . . Illegal executable code at the module level . . . Illegal PUBLIC instance of PRIVATE class or type: . . . . . . . . . . . . . Illegal type suffix on name: . . . . . . ISELEMENT argument is not a list or variant: . . . . . . . . . . . . . . . Illegal scope for PUBLIC or PRIVATE on: Illegal constructor clause on: . . . . Parent SUB NEW has arguments, SUB NEW is required for: . . . . . . . . . Illegal USE or UseLSX statement after declaration Member declared in a parent class . . . . . . Event handler must be a LotusScript SUB or FUNCTION: . . . . . . . . Member of PUBLIC class or type is instance of a PRIVATE class or type: . . . . . FORALL alias variable was previously declared: . . . . . . . . . . . . . . . FORALL alias variable already in use: . . . . . . . . . . . . . . . . CASE ELSE must be the last CASE in a SELECT statement . . . . . . . . . . . . . . . TYPE declaration has no members . . . . . . Declaration of external subprogram is not legal inside a class . . . . . . . . . . . . . Illegal use of array or list element as FORALL target . . . . . . . . . . . . . . . . Illegal use of property: . . . . . Wrong data type for argument in event handler . . . . . . Maximum array dimensions (8) exceeded: . . . . . . . . . . . . . . . . Illegal array bound for: . . . . . Array size exceeds maximum: . . . Illegal specification of array bounds for: . . . . . . . . . . . . . . . . Declaration not valid in TYPE scope: . . . Statement is illegal in TYPE block: . . Statement is illegal in CLASS block: . . TYPE may not have instance of itself as a member: . . . . . . . . . . . . . Out of memory . . . . . . . . . . . . . Size of data cannot exceed 64K in this scope . . . Size of data cannot exceed 32K in this scope . . . Illegal constant expression for: . .

511 511 511 511 512 512 512 512 513 513 513 514 514 514 514 514 514 515 515 515 515 516 516 516 516 517 517 517 517 517 518 518 518 518 518 518 519 519 519 519 520 520 520

Arguments not legal in declaration of: Undefined label: . . . . . . . . Illegal data type for argument: Too many arguments for: . . . Cannot subclass: . . . . . . . . Derived class may not be PUBLIC when parent is PRIVATE: . . . . . . . . . . Illegal use of NEW or DELETE . . . . . . . DIM required on declarations in this scope . . . Illegal PRIVATE declaration of: . . . . . Illegal PUBLIC declaration of: . . . . . Name was forward declared as something else: . . . . . . . . . . . . . . . Duplicate forward declaration: . . . . . Storage class or visibility does not match forward declaration: . . . . . . . Return type does not match forward declaration: . . . . . . . . . . . . Number of arguments does not match forward declaration: . . . . . . . Argument does not match forward declaration: . . . . . . . . . . . . Illegal function return type for: Method was declared as something else in a parent: . . . . . . . . . . Method signature does not match parent method: . . . . . . . . . . . . . PROPERTY GET and SET must have same storage class and visibility . . . . . . . . . . . . Illegal property type for: . . . . PROPERTY GET and SET must have same data type . . . . . . . . . . . . . . . . Property was declared as something else in a parent: . . . . . . . . . . Property type does not match parent property: . . . . . . . . . . . . Illegal pass by value: . . . . . Illegal STATIC on: . . . . . . . . . Illegal external argument: . . . Illegal construction of type instance: . . . . . . . . . . . . . . . . Class or type name not found: . . . . . Illegal range specifier . . . . . . . . . . . Illegal DEFtype statement after declaration. . . . Duplicate range specifier . . . . . . . . . Label is illegal outside of a subprogram . . . . Error number must be INTEGER constant: Error number must be INTEGER . . . . . . . Illegal ON ERROR statement . . . . . . . . Statement is illegal outside of a subprogram . . . Not a product class: . . . . . . . . Not a product class instance: . . . . . Not an event name: . . . . . . . . Not a sub or function name: . . . . . Illegal REDIM on: . . . . . . . . . Illegal RESUME statement . . . . . . . . . FOR count variable already in use: . . . FORALL alias variable is not of same data type: . . . . . . . . . . . . . . . FOR count variable must be a scalar variable: . . . . . . . . . . . . . . .Contents

520 520 521 521 521 521 521 521 521 522 522 522 522 522 523 523 523 524 524 524 525 525 525 525 526 526 526 526 527 527 527 528 528 528 528 528 528 529 529 529 529 529 530 530 530 530

xvii

Illegal type suffix on FORALL alias variable: . . . . . . . . . . . . . . . Not a PUBLIC member: . . . . . . . Illegal reference to FORALL alias variable: Type suffix does not match data type: . . Not a member: . . . . . . . . . . Variable not declared: . . . . . . . . Illegal single-line IF . . . . . . . . . . . Name does not match FOR count variable: Not an array, list, collection or variant: . . ME not valid outside of class scope . . . . . . .. not valid outside of class scope . . . . . . . Reference must contain exactly one subscript: . . . . . . . . . . . . . . . Illegal parenthesized reference: . . . . . Wrong number of array subscripts for: . . . . . . . . . . . . . . . . Not an instance name: . . . . . . . Bounds must be specified in REDIM of: . . . . . . . . . . . . . . . . Variable required: . . . . . . . . . Named product class instance not valid here . . . Illegal reference to: . . . . . . . . . Numeric overflow . . . . . . . . . . . . Numeric underflow . . . . . . . . . . . Illegal numeric constant . . . . . . . . . . Illegal product constant: . . . . . . . Name too long: . . . . . . . . . . Token is too long . . . . . . . . . . . . Declaration may not contain type suffix and data type: . . . . . . . . . . . . . Illegal string length constant for: . . . . Illegal use of NEW on array or list declaration: . . . . . . . . . . . . . . . INCLUDE filename must be a string constant . . Cannot open included file: . . . . . Unterminated %REM block . . . . . . . . . Unterminated string constant . . . . . . . . Unterminated multiline string . . . . . . . . Unterminated square bracket reference . . . . . Illegal character after continuation character . . . Illegal character after %INCLUDE directive . . . SET required on class instance assignment. . . . Unterminated block . . . . . . . Unexpected: ; Expected: . . . . Parser stack overflow at: . . . . . Unknown statement . . . . . . . . . . . Maximum number of errors reached. . . . . . PROPERTY SET not defined for: PROPERTY GET not defined for: Duplicate option . . . . . . . . . . . . Missing argument for: . . . . . Expected expression before end of argument list for: . . . . . . . . . . . Wrong number of arguments for: . . . . LISTTAG argument is not a FORALL alias variable Type mismatch on: . . . . . . . . . Illegal BYVAL on arguments to: Illegal TO in reference to: . . . . . . Illegal BYVAL . . . . . . . . . . . . . Duplicate label: . . . . . . . .

530 531 531 531 531 531 531 532 532 532 532 532 533 533 533 533 533 534 534 534 535 535 535 535 535 535 536 536 536 536 536 536 537 537 537 537 537 538 538 539 539 539 539 539 539 540 540 540 540 540 542 542 542 542

Illegal EXIT . . . . . . . . . Illegal OPTION PUBLIC after declaration . . . . Illegal use of ERASE . . . . . . . . . . . SET may only be used on class instance assignments . . . . . . . . . . . . . . Illegal pass by value . . . . . . . . . . . Wrong number of arguments to constructor for class: . . . . . . . . . . . . Illegal reference to array or list: Illegal type suffix on keyword: . . . . Compiler statement stack overflow at: . . . . . . . . . . . . . . . . Maximum allowable code size exceeded . . . . Maximum allowable data size exceeded . . . . Maximum allowable symbol table size exceeded PUBLIC is not allowed in this module . . . . . Illegal call to: . . . . . . . . . Empty parentheses not legal on: . . . . Illegal use of parentheses . . . . . . . . . Class not specified on BIND into: . . . . Illegal Directive . . . . . . . . . . . . Unterminated %IF, %ELSEIF, or %ELSE directive Illegal character after directive . . . . . . . . LIB name must be a string constant . . . . . . USE or USELSX name must be a string constant EVALUATE argument must be a string constant Illegal second parenthesized expression . . . . Statement is illegal in a subprogram . . . . . . Illegal use of UNICODE or LMBCS keyword . . . UNICODE and LMBCS strings must be declared BYVAL . . . . . . . . . . . . . . . Too many nested WITHs . . . . . . . . . Illegal use of escape character in identifier: Illegal use of escape character . . . . . . . . Error in EVALUATE macro . . . . . . . . . Name previously referenced in this scope . . . . Wrong number of arguments for event handler: . . . . . . . . . . . . . . Property is read-only: . . . . Missing array subscript or collection index for: . . . . . . . . . . . . . . . Missing argument to constructor for: Missing array bound for: . . . . LEN argument must be a variable or string expression . . . . . . . . . . . . . . Missing collection index for: . . . . . Missing list subscript for ISELEMENT argument: . . . . . . . . . . . . . . Cannot assign into collection item . . . . . . Cannot forward declare CLASS or TYPE . . . . CLASS or TYPE declaration may not be inside a control block . . . . . . . . . . . . . Procedure declaration may not be inside a control block . . . . . . . . . . . . . . . . Product class does not have a New method: . . . . . . . . . . . . . . . . Collection item is not an instance . . . . . . . Illegal on declarations in this scope: . . Wrong return type in event handler . . . . . . . . . . . . . Event handler must be a FUNCTION . . . . .

543 543 543 543 543 544 544 545 545 545 545 545 545 546 546 546 546 547 547 547 547 547 548 548 548 548 549 549 549 549 549 549 550 550 550 550 551 551 551 551 552 552 552 552 552 552 552 553 553

xviii

LotusScript Language Guide

Event handler must be a SUB . . . . . . . . Conflicting option . . . . . . . . . . . . PROPERTY GET and SET arguments do not match: . . . . . . . . . . . . Number of arguments do not match for PROPERTY GET and SET . . . Property signature does not match parent property: . . . . . . . . . . . . Type suffix character required on: . . . . Must be a sub: . . . . . . .

553 553 553 553 553 554 554

Appendix G Run-time Error Messages . . . . . . . . . . 555User-defined error . . . . . . . . RETURN without GOSUB . . . . . Illegal function call . . . . . . . Overflow . . . . . . . . . . . Invalid ^ operator operands . . . . Out of memory . . . . . . . . . Subscript out of range . . . . . . Expression out of range . . . . . . Duplicate PUBLIC name in USE module: name> . . . . . . . . . . . . Division by zero . . . . . . . . Type mismatch . . . . . . . . . Out of string space . . . . . . . No RESUME . . . . . . . . . RESUME without error . . . . . . Out of stack space . . . . . . . . Sub or function not defined . . . . Error in loading DLL . . . . . . . Bad DLL calling convention . . . . Internal error . . . . . . . . . Bad file name or number . . . . . File not found . . . . . . . . . Bad file mode . . . . . . . . . File already open . . . . . . . . Device I/O error . . . . . . . . File already exists . . . . . . . . Bad record length . . . . . . . . Disk full . . . . . . . . . . . Input past end of file . . . . . . . Bad record number . . . . . . . Bad file name . . . . . . . . . Too many files . . . . . . . . . Device unavailable . . . . . . . Permission denied . . . . . . . . Disk not ready . . . . . . . . . Cannot rename with different drive . . Path/file access error . . . . . . . Path not found . . . . . . . . . Object variable not set . . . . . . FOR loop not initialized . . . . . . Invalid pattern string . . . . . . . Invalid use of NULL . . . . . . . Cannot destroy active instance . . . File not writable . . . . . . . . File not readable . . . . . . . . Illegal file number . . . . . . . . File not open . . . . . . . . . Conflicting modes supplied . . . . . . . . . . . . . . . . . . . . . . . . . . . . = &B100000 ... (31 zeroes) represent negative numbers. The legal prefix is &B. An octal integer is % forces Integer expressible in up to 11 octal digits of 0 to 7. If the number & forces Long falls within the range for Integer values, its data type is Integer; otherwise, its data type is Long.

Octal number

&O1411

Long Values >= &O40000000000 are out of range. Values >= &O20000000000 represent negative numbers.

Hexadecimal number

&H309

Long. Values = > &H80000000 represent negative numbers. Negative signs (-) are not allowed.

A hexadecimal number is % forces Integer expressible in 1 to 8 significant hexadecimal digits & forces Long (excluding leading zeroes). If the number falls within the range for Integer values, its data type is Integer; otherwise, its data type is Long.

Literal string construction rulesA literal string in LotusScript is a string of any characters enclosed in one of the following sets of delimiters: v A pair of double quotation marks ( )"A quoted string"

v A pair of vertical bars ( | | )|A bar string|

v Open and close braces ( { } ){A brace string}

Strings enclosed in vertical bars or braces can span multiple lines.|A string on two lines|

To include one of the closing delimiter characters , |, or } as text within a string delimited by that character, double it.|A bar string with a bar || in it|

The empty string has no characters at all; it is represented by . Strings delimited by vertical bars, braces, or double quotation marks cannot be nested.

8

LotusScript Language Guide

"A "A |A {A

quoted string with {braces} and a bar | in it" quoted string with ""quotes"" in it" bar string with a bar || in it| brace string with {braces}} in it}

Identifier construction rulesAn identifier is the name you give to a variable, a constant, a type, a class, a function, a sub, or a property. The following rules govern the construction of identifiers in a script. v The first character must be an uppercase or lowercase letter. v The remaining characters must be letters, digits, or underscore ( _ ). v v v v A data type suffix character (%, &, !, #, @, or $) can be appended, but is not part of the identifier. The maximum length is 40 characters, not including the optional suffix character. Names are case insensitive. For example, VerED is the same name as vered. Characters with ANSI codes higher than 127 (those outside the ASCII range) are legal.

Escape character for illegal identifiersSome Lotus software classes and OLE classes may define properties or methods whose identifiers use characters not legal in LotusScript identifiers. Variables registered by Lotus software applications might also use such characters. In these cases, prefix the illegal character with a tilde (~) to make the identifier valid.

Examples $ is illegal as character in identifier Call ProductClass.LoMethod$ Illegal Call ProductClass.LoMethod~$ Legal X = OLEClass.Hi@Prop X = OLEClass.Hi~@Prop Illegal Legal

LabelsA label gives a name to a s