If a unit of measure is not specified, the default is WordPerfect (WP) units. To change the default, use DefaultUnits. The following example converts WP units to centimeters and returns the result as a string:
Units := UnitStr(1200; Centimeters!)
Result: vUnits equals "2.540000C"
The next example converts centimeters to millimeters and returns the result as a string:
DefaultUnits(Centimeters!)
vUnits := UnitStr(1.0; Millimeters!)
Result: vUnits equals "10.000000M"
The next example converts inches to centimeters and returns the result as a string:
vUnits := UnitStr(2.0i; Centimeters!)
Result: vUnits equals "5.080000C"
See StrUnit to convert a string of numbers to a measurement expression.
Return Value
A measurement expressed as a string.
Parameters
Value: any A real number measurement. Unless you specifiy a unit of measure, the default is WP Units. To change the default, use DefaultUnits.
Units: enumeration The unit of measure that Value converts to.
Centimeters!
Inches!
Millimeters!
Points! (72 per inch)
WPUnits! (1200 per inch)
WP1200ths! (1200 per inch)
Until
Example
Syntax
(<Test> boolean)
Description
Specify the condition for closing a Repeat control loop. See Repeat.
Use
Example
Syntax
(<MacroFile> string)
Description
Specify a macro file with functions and/or procedures that can be called from another macro.
Use is a non-executable statement that can occur anywhere in a macro. A macro with a calling statement to a function or procedure in another macro file must include a Use statement that identifies the file.
A Use macro file that includes only function and/or procedure statements must be compiled like any macro file. Corel PerfectScript automatically compiles uncompiled Use macros. Macro execution stops if the macro will not compile.
Macro files identified by multiple Use statements are searched from first to last. Thus a parent macro always calls the first occurrence of a function or procedure with the same name in different Use files.
Parameters
<MacroFile> string The path and name of a macro file. You cannot substitute string with a variable.
any := Value
Syntax
(<Value> any)
Description
Return the value of an enumeration or the internal product command ID value for a command.
If specifying a product command name, do not enclose the command in quotes. For example, x := Value(MessageBox).
If specifying a product command parameter enumeration, use the product command name, a period, the parameter name, a period, and the enumeration. For example, x := Value(MessageBox.Style.OKCancel!).
If using this command to obtain the value of a product command return enumeration value, specify the product command name, a period, and the return enumeration name. For example, x := Value(PersistAll.On!).
Using Value to obtain enumeration values is optional. The following syntax is also correct: x := MessageBox.Style.OKCancel! or x := PersistAll.On!
Parameters
<Value> any An enumeration or command.
enumeration or boolean := ValueType
Syntax
(Value: any; [;Type: enumeration])
Description
Return data type information about a variable or a value.
Examples
DECLARE myName
DECLARE myAns
//*** Assign a string value to myName
myName := "Frank Jones"
//*** ValueType returns true
myAns = ValueType(myName; String!)
//*** ValueType returns false
myAns = ValueType(myName; Numeric!)
Return Value
This command returns either the type of the value or a True/False value (depending on input parameters). The possible enumerations are:
CurrentType!
Boolean!
WPString!
AnsiString!
OemString!
Float!
Integer!
DateTime!
Centimeters!
Inches!
Millimeters!
Points!
WPUnits!
RawBinary!
Object!
Parameters
Value: any The value to be tested (any valid expression including a variable name).
Type: enumeration (optional) The type to test for. True if Value is of the specified Type, or False if not. If missing, the data type of Value is returned.
CurrentType! Current value type
Boolean! Value must be a boolean value.
WPString! WordPerfect string.
AnsiString! ANSI string.
OemString! OEM string.
Float! Floating point value.
Integer! Integer value.
DateTime! DateTime value, stored as a numeric by the Date and Time commands. See the DateAndTime command for more information.
Centimeters! Centimeters measurement value.
Inches! Inches measurement value.
Millimeters! Millimeters measurement value.
Points! Points measurement value.
WPUnits! WP Units measurement value.
RawBinary! Raw binary measurement value
Object! OLEObject variable.
numeric := Variance
Syntax
([Type: enumeration]; [Value: numeric])
Description
This command computes the statistical variance of a list of data values.
Return Value
The variance of the data.
Parameters
Type:
enumeration Whether the list of data values represents the entire population of data values, or just a sample of the values. If missing, Population! is used.
Population! List is entire set of data values.
Sample! List is a sample of the entire set of data values.
Value:
numeric The list of data values to compute the variance for.
enumeration := VarErrChk
Example
Syntax
([State: enumeration])
Description
Determine how a macro responds to uninitialized variables, or variables not assigned a value.
Return Value
Off! Previous VarErrChk state was Off!
On! Previous VarErrChk state was On!
Parameters
State: enumeration (optional) Specify the state of variable checking. The default is VarErrChk(On!). If missing, the current state is returned without changing it.
Off! Ignore uninitialized variables by temporarily assigning a value of 0.
On! Display a run-time Error message when a macro attempts to use an uninitialized variable, and end the macro.
string or numeric := VersionInfo
Syntax
(VersionInfo: string or enumeration; [VersionItem: enumeration][ObjectItem: enumeration)
Description
Return an item's version information.
Return Value
Version information.
Parameters
VersionInfo: string or enumeration A filename or enumeration of a predefined item.
"<filename>" Return version information about a specified file.
PlatformVersion! Return version information about the platform.
PerfectFitVersion! Return version information about PerfectFit.
PerfectScriptVersion! Return version information about PerfectScript.
VersionItem: enumeration (optional) The type of version information to return. If missing, FullVersion! | Numeric! is used.
FullVersion! Return the full version, including the major, minor, maintenance or build number and sub-build number.
Item to return: MajorVersion! Return the major version number only.
MinorVersion! Return the minor version number only.
MaintenanceVersion! Return the maintenance version or build number only.
BuildNumber! Return the maintenance version or build number only.
SubBuildNumber! Return the sub-build number only.
ObjectItem: enumeration The item that version information is requested for.
WordPerfectVersion! Return information about WordPerfect.
PresentationsVersion! Return information about Presentations.
QuattroProVersion! Return information about QuattroPro.
Format of the item to return: Numeric! Return the item as a numeric value in the form: Mmmmnnn where M is the major version number, mmm is the minor version number (0 padded to three digits), and nnnn is the build number (0 padded to four digits).
String! Return the item as a string value in the form: "M.mm.nnn" where "M" is the major version number, "mm" is the minor version number (0 padded to two digits, and "nnn" is the build number (0 padded to three digits).
Wait
Example
Syntax
(TenthsOfSeconds: numeric)
Description
Pause macro execution.
Time is measured in tenths of a second. The maximum pause is one minute, or Wait(600).
Parameters
TenthsOfSeconds: numeric A number from zero to 600. Divide the number by 10 to calculate the number of seconds.
While
Example
Syntax
(<Test> boolean)
Description
A loop statement that executes while the expression at the top of the loop is true.
The loop does not execute the first time unless Test is true. When Test is false, the first statement after EndWhile is executed.
Example
The general form of a While statement is:
While (<Test> boolean)
...statement block...
EndWhile
Parameters
<Test> boolean Evaluate to true or false.
With
Syntax
(ObjectVariable: variable)
Description
Define a local block, in which the current default product or object is temporarily changed. After EndWith, the previous default product or object is restored. With-EndWith statements can be nested, establishing nested blocks of localized default object prefixes.
Parameters
ObjectVariable: variable New default product or object prefix for the statements inside the With block. Default prefixes can be replaced with "..", which informs the macro compiler that the method or property name following the ".." belongs to the current default prefix.
WordLength: numeric (optional) The length of words to count. If missing, or less than or equal to zero, all words are counted.
SeparatorChars: string (optional) The character(s) used to separate words. If missing, white-space characters are used.
Option: enumeration (optional) The type of counting to perform. If missing, the value of WordLength determines which words are counted. Default: CountWords!
CountWords! See the WordLength parameter.
CountShorter! Count words shorter than the specified length.
CountLonger! Count words longer than the specified length.
ShortestLength! Return the length of the shortest word (ignore WordLength).
LongestLength! Return the length of the longest word (ignore WordLength).
AverageLength! Return the average word length (ignore WordLength).
string := WPString
Syntax
(<Value> string)
Description
Pass a value as a WordPerfect string (DLL call in-line parameter and OLE type casting function). See DLLCall and OLE Automation.
boolean := boolean XOR boolean
Description
Operator. Precedence level 9. Combine two relationship expressions.
Return Value
True if only one expression is true, or False if both are true or both are false.