Chapter 11
Corel® PerfectScript Programming Commands
Corel® PerfectScript Programming Commands
Three new macro commands have been added: MacroCompile, MacroIsCompiled, and MacroPlay. See online Help for information about these commands. Also, the following commands have been changed: DialogAddControl, DialogDelete, FileFind, FileNameDialog, GetFileAttributes, MacroInfo, OLEAutomation, and SetFileAttributes. See online Help for information about these commands.
|
tan |
| Purpose | Get the tangent of an angle in radians. | |||
| Return Value | Tangent of an angle in radians. | |||
| Syntax |
|
|||
| Parameters |
|
|
tanh |
| Purpose |
Get the hyperbolic tangent of an angle in radians. |
|||
| Return Value | Hyperbolic tangent of an angle in radians. | |||
| Syntax |
|
|||
| Parameters |
|
|
TimeHour |
| Purpose | Return a number representing the hour on a 24-hour clock. | |||
| Return Value | Number if successful, or DateAndTime.Error! if not. | |||
| Syntax |
|
|||
| Parameters |
|
|
TimeHundredth |
| Purpose | Return a number representing hundredths of a second. | |||
| Return Value |
Number if successful, or DateAndTime.Error! if not. |
|||
| Syntax |
|
|||
| Parameters |
|
|
TimeMinute |
| Purpose | Return a number representing the minute. | |||
| Return Value | Number if successful, or DateAndTime.Error! if not. | |||
| Syntax |
|
|||
| Parameters |
|
|
TimeSecond |
| Purpose |
Return a number representing the second. |
|||
| Return Value |
Number if successful, or DateAndTime.Error! if not. |
|||
| Parameters |
|
|||
| Syntax |
|
|||
| Parameters |
|
|
TimeString |
| Purpose |
Return the time in a string. vCurrentTime := TimeString (; "h:m:ss tt") MessageBox (x; "TimeString"; vCurrentTime) Result (format): 3:52:34 PM |
||||||
| Return Value | String if successful, or empty string ("") if not. | ||||||
| Parameters |
|
||||||
| Syntax |
|
|
TimeZoneInfo |
| Purpose | Return information about the current time zone and time change. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | Requested information. InfoItem parameter describes the type of data returned for each item. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
ToInitialCaps |
| Purpose | Capitalize the first character in a string, or the first character of the words in a string. | ||||||||||||
| Return Value | The mixed case equivalent of a specified string. | ||||||||||||
| Syntax |
|
||||||||||||
| Parameters |
|
|
ToLower |
| Purpose |
Convert uppercase letters to lowercase. The value returned by ToLower can be assigned to a variable or used directly by a statement such as If.
Result: vAnswer equals lowercase yes
Explanation: Beep if vAnswer equals lowercase yes. |
|||
| Examples | Appendix A: 8040 | |||
| Return Value | The lowercase equivalent of uppercase letters. | |||
| Syntax |
|
|||
| Parameters |
|
|
ToUpper |
| Purpose |
Convert lowercase letters to uppercase. The value returned by ToUpper can be assigned to a variable or used directly by a statement such as If.
Result: vAnswer equals uppercase YES
Explanation: Beep if vAnswer equals uppercase YES. |
|||
| Examples | Appendix A: 8005 | |||
| Return Value | The uppercase equivalent of lowercase letters. | |||
| Syntax |
|
|||
| Parameters |
|
|
True |
| Purpose |
The constant boolean value TRUE. |
| Syntax | boolean := True |
|
UnitStr |
| Purpose |
Convert a measurement to a character string. 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. | |||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||
| Parameters |
|
|
Until |
| Purpose | Specify the condition for closing a Repeat control loop. See Repeat. | ||
| Examples | Appendix A: 8004 | ||
| Syntax |
|
|
Use |
| Purpose |
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 (see Macro File Libraries in Chapter 5: Conditional, Loop, and Calling Statements). 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. |
|||
| Examples | Appendix A: 8042 | |||
| Syntax |
|
|||
| Parameters |
|
|
Value |
| Purpose | Return the value of an enumeration or the internal product command ID value for a command. | |||
| Syntax |
|
|||
| Parameters |
|
|||
|
Notes |
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! |
|
ValueType |
| Purpose | Return data type information about a variable or a value. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | If Type is specified, then return True if Value is of the specified Type, or False if not. If Type if not specified, the actual data type of Value is returned as an enumeration. The possible enumerations are: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Boolean! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WPString! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AnsiString! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OemString! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Float! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Integer! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DateTime! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Centimeters! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Inches! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Millimeters! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Points! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WPUnits! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Object! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Examples |
Result: MessageBox displays True
Result: MessageBox displays "vNmbr is not an integer value" |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
VarErrChk |
| Purpose | Determine how a macro responds to uninitialized variables, or variables not assigned a value. | |||||||||
| Examples | Appendix A: 8040 | |||||||||
| Return Value |
|
|||||||||
| Syntax |
|
|||||||||
| Parameters |
|
|
VersionInfo |
| Purpose | Return an item's version information. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Return Value |
|||||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
Wait |
| Purpose | Pause macro execution. Time is measured in tenths of a second. The maximum pause is one minute, or Wait(600). | |||
| Examples | Appendix A: 8025 | |||
| Syntax |
|
|||
| Parameters |
|
|
While |
| Purpose |
A loop statement that executes while the expression at the top of the loop is true (see Loop Statements in Chapter 5: Conditional, Loop, and Calling Statements). The loop does not execute the first time unless Test is true. When Test is false, the first statement after EndWhile is executed. |
|||
| Examples | Appendix A: 8012 | |||
| Examples |
The general form of a While statement is:
|
|||
| Syntax |
|
|||
|
||||
| Parameters |
|
|
With |
| Purpose | 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, which establishes nested blocks of localized default object prefixes. | |||
| Syntax |
|
|||
|
||||
| Parameters |
|
|
WordCount |
| Purpose | Count the words in a string. | ||||||||||||||||||||||||||||||
| Return Value |
The number of words in a string. |
||||||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||||||
| Parameters |
|
|
WPString |
| Purpose | Pass a value as a Corel WordPerfect string (DLL call in-line parameter function). See DLLCall. | ||
|
ReturnValue |
string | ||
| Syntax |
|
|
XOR |
| Purpose | Operator. Precedence level 9. Combine two relationship expressions. See Logical Operators andLogical Expressions in Chapter 4: Expressions. |
| Return Value | True if only one expression is true, or False if both are true or both are false. |
| Syntax | boolean := boolean XOR boolean |