This document describes features in the WordPerfect Macro system. This version of this document also includes the undocumented features and commands.
Document Change Log
9/9/97 JDan 1.0 - Document created to document the macro system of WordPerfect 5.1.
Command Inserter
The command inserter can be used from WordPerfect to build and insert a macro command into a macro while editing the macro.
Commands and Language Features
This section describes the commands and features in the WordPerfect Macro system.
reserverd words
The following words are reserved and may not be used as variable names:
Address
AND
AnsiString
Application
AssertCancel
AssertError
AssertNotFound
Assign
Beep
Bool
Byte
ByteLen
BytePos
Call
CancelOff
CancelOn
Case
Centimeters
Chain
Char
Default
DefaultUnits
Digit
DIV
DLLCall
DLLFree
DLLLoad
DWord
Else
EndApp
EndFor
EndIf
EndPrompt
EndWhile
ErrorNumber
ErrorOff
ErrorOn
False
File
For
ForEach
Fraction
Function
GetNumber
GetString
GetUnits
Go
HiWord
If
Inches
Input
Integer
Label
Length
Letter
LoWord
Menu
MOD
NewDefault
Not
NumStr
OemString
OnCancel
OnError
OnNotFound
OR
Pause
Points
Position
Prompt
Quit
Real
Repeat
Return
ReturnCancel
ReturnError
ReturnNotFound
Run
ShortSignature
Speed
StrLen
StrNum
StrPos
SubByte
SubStr
True
Until
Variable
Version
Wait
While
Word
WPString
WPUnits
XOR
expression types
numeric integer and floating point
measurement C, I, P, W, "
relational TRUE, FALSE
character character strings in " symbols
variables
Variable names may be 30? characters long.
strings 64KB
numeric -1.797E-308 to 1.797E+308 with 15 digits, -2147483648 to 2147483647
enumerations
Value names terminated with a ! character.
labels
Label names may be 30? characters long, and are terminated with a @ character.
operator precedence
The operator precedence order is:
unary -, unary +, NOT 1
*, /, %, DIV, MOD, AND 2
-, +, OR, XOR 3
=, <>, >, <, <=, >= 4
// comment
All remaining text on the current line until a hard return is considered a comment and is ignored.
unary - <Right>numeric
Numerically negate a numeric value.
return-value The result of negating the operand.
Right The operand.
unary + <Right>numeric
This operator returns the operand as is.
return-value The operand.
Right The operand.
<Left>numeric * <Right>numeric
Multiply two numbers together.
return-value The result of concatenating the two operand strings.
Left The Left operand.
Right The right operand.
<Left>numeric / <Right>numeric
Floating point divide two numbers.
return-value The result of concatenating the two operand strings.
Left The Left operand.
Right The right operand.
<Left>numeric % <Right>numeric
Floating point modulus two numbers.
return-value The result of concatenating the two operand strings.
Left The Left operand.
Right The right operand.
<Left>numeric - <Right>numeric
Subtract two numbers.
return-value The result of concatenating the two operand strings.
Left The Left operand.
Right The right operand.
<Left>numeric + <Right>numeric
Concatenate two strings together.
return-value The result of concatenating the two operand strings.
Left The Left operand.
Right The right operand.
<Left>string + <Right>string
Add two numbers together.
return-value The result of concatenating the two operand strings.
Left The Left operand.
Right The right operand.
<Left>any = <Right>any
Compare two values for equality.
return-value The result of comparing the two operands.
Left The Left operand.
Right The right operand.
<Left>any <> <Right>any
Compare two values for inequality.
return-value The result of comparing the two operands.
Left The Left operand.
Right The right operand.
<Left>any > <Right>any
Compare two values for greater than.
return-value The result of comparing the two operands.
Left The Left operand.
Right The right operand.
<Left>any < <Right>any
Compare two values for less than.
return-value The result of comparing the two operands.
Left The Left operand.
Right The right operand.
<Left>any <= <Right>any
Compare two values for less than or equal to.
return-value The result of comparing the two operands.
Left The Left operand.
Right The right operand.
<Left>any >= <Right>any
Compare two values for greater than or equal to.
return-value The result of comparing the two operands.
Left The Left operand.
Right The right operand.
<Variable>variable := <Expression>any
Assign the expression value to the specified variable.
Variable The name of the variable to assign the value to.
Expression The expression value to assign to the variable.
Address (<Variable>variable)
Pass a variable by address in a DLLCall command.
return-value Essentially the address of the storage location of the specified variable.
Variable The variable to pass by address to a DLLCall command.
<Left>any AND <Right>any
Perform logical AND operation on two operands.
return-value The result of a logical AND operation on the two operands.
Left The Left operand.
Right The right operand.
Application (<ProductPrefix>identifier; <ProductIdentifier>keyword; [<Default>keyword]; [<FileName>string])
Specify that product commands from an application will occurr within this macro.
ProductPrefix A 2 character product prefix that will be used to identify product commands of this application. This prefix must be used unless the DEFAULT keyword is used, and then the product prefix for the default application is optional on calls to product commands of that application.
ProductIdentifier The application that this product prefix and subsequent product commands will be associated with. The product identifier may be one of the following.
WPWP WordPerfect
WPSP Speller
WPTH Thesaurus
WPMF Macro Facility
WPFM File Manager
At this time, only WordPerfect supports product commands in a macro.
Default This application will become the default application for subsequent product commands that have no product prefix. Is missing, then all product commands for this application must be prefixed by the product mnemonic specified above.
DEFAULT This will be the default application.
FileName The name of the Product Interface Description file which describes the product commands for this application. If missing, the WPC.INI file is checked for this product identifier to determine the PID file to use. If WPC.INI contains no filename, then WPWPUS.WCD is used.
AssertCancel
Assert a cancel condition, as if a product command had generated this condition.
AssertError
Assert an error condition, as if a product command had generated this condition.
AssertNotFound
Assert a not found condition, as if a product command had generated this condition.
Assign (<Variable>variable; <Expression>any)
Assign an expression value to a variable.
Variable The name of the variable to assign the value to.
Expression The expression value to assign to the variable.
Beep
Cause the computer to produce a beep tone.
ByteLen (<Variable>variable; <Expression>string)
BytePos (<Variable>variable; <SubExpression>string; <Expression>string)
Call (<Label>label)
CancelOff
CancelOn
Case (<Test>any; {<Case>any; <Label>label}; <DefaultLabel>label)
Case Call (<Test>any; {<Case>any; <Label>label}; <DefaultLabel>label)
Chain (<MacroName>string)
DefaultUnits (<UnitOfMeasure>keyword)
UnitOfMeasure
CENTIMETERS
INCHES
POINTS
WPUNITS
<Left>numeric DIV <Right>numeric
Concatenate two strings together.
return-value The result of concatenating the two operand strings.
Left The Left operand.
Right The right operand.
DLLCall (<Link>numeric; <Function>string; <FromDLL>variable; <DataType>keyword; {<ToDLL>any})
DataType
BOOL
DWORD
INTEGER
REAL
STRING
WORD
ToDLL
HIWORD
LOWORD
ADDRESS
DLLFree (<Link>numeric)
DLLLoad (<Link>variable; <DLL>string)
Else
EndApp (<ProductPrefix>identifier)
EndFor
EndIf
EndPrompt
EndWhile
ErrorOff
ErrorOn
False
For (<Variable>variable; <InitialValue>any; <Test>any; <Increment>any)
ForEach (<Variable>variable; {<Expression>any})
Fraction (<Variable>variable; <NumericExpression>numeric)
GetNumber (<Variable>variable; <Prompt>string; <Title>string)
GetString (<Variable>variable; [LENGTH=<NumericExpression>numeric]; <Prompt>string; <Title>string)
GetUnits (<Variable>variable; <Prompt>string; <Title>string)
Go (<Label>label)
HiWord (<Expression>any)
If (<Test>any)
Integer (<Variable>variable; <NumericExpression>numeric)
Label (<Name>label)
LoWord (<Expression>any)
Menu (<Variable>variable; <MnemonicType>keyword; [<HorizontalPosition>numeric]; [<VerticalPosition>numeric]; {<Option>string})
MnemonicType
DIGIT
LETTER
<Left>numeric MOD <Right>numeric
Concatenate two strings together.
return-value The result of concatenating the two operand strings.
Left The Left operand.
Right The right operand.
NOT <Right>any
Concatenate two strings together.
return-value The result of concatenating the two operand strings.
Left The Left operand.
Right The right operand.
NewDefault (<ProductPrefix>identifier)
NumStr (<Variable>variable; <DecimalPlaces>numeric; <Expression>numeric)
OnCancel (<Label>label)
OnCancel Call (<Label>label)
OnError (<Label>label)
OnError Call (<Label>label)
OnNotFound (<Label>label)
OnnotFound Call (<Label>label)
<Left>any OR <Right>any
Concatenate two strings together.
return-value The result of concatenating the two operand strings.
Left The Left operand.
Right The right operand.
Pause
Prompt (<Title>string; <Prompt>string; [<Icon>numeric]; [<HorizontalPosition>numeric]; [<VerticalPosition>numeric])
Icon If missing, 0 is used.
0 No icon.
1 Stop sign icon.
2 Question mark icon.
3 Explmation point icon.
4 Information icon.
<0 Information icon.
>4 Information icon.
Quit
Repeat
Return
ReturnCancel
Return from a label, and assert a cancel condition, as if a product command had generated this condition.
ReturnError
Return from a label, and assert an error condition, as if a product command had generated this condition.
ReturnNotFound
Return from a label, and assert a not found condition, as if a product command had generated this condition.
Run (<Macro>string)
Speed (<Tenths>numeric)
StrLen (<Variable>variable; <CharacterExpression>string)
StrNum (<Variable>variable; <CharacterExpression>string)
StrPos (<Variable>variable; <SubExpression>string; <Expression>string)
SubByte (<Variable>variable; <StartPosition>numeric; <Length>numeric; <Expression>string)
SubStr (<Variable>variable; <StartPosition>numeric; <Length>numeric; <Expression>string)
True
Until (<Test>any)
Wait (<Tenths>numeric)
While (<Test>numeric)
<Left>any XOR <Right>any
Concatenate two strings together.
return-value The result of concatenating the two operand strings.
Left The Left operand.
Right The right operand.