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.
|
RadiansToDegrees |
| Purpose | Convert an angle in radians to degrees. | |||
| Return Value | Angle in radians converted to degrees. | |||
| Syntax |
|
|||
| Parameters |
|
|
Randomize |
| Purpose | Randomize the random number seed. | |||
| Return Value | Randomized number. | |||
| Syntax |
|
|||
| Parameters |
|
|
RandomNumber |
| Purpose |
Get a random number in a range. If only a Minimum or Maximum value is given (see Parameters below), a number between 0.0 and that value is returned. The range includes 0.0; it does not include the value. If no values are given, a number between 0.0 and 1.0 is returned. The range includes 0.0; it does not include 1.0. |
||||||
| Return Value | Random number in a range. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RandomSeed |
| Purpose | Get the current seed of the random number generator. |
| Return Value | Value of the random seed. This seed is used to generate the next random number, after which the random seed is updated to a new value. |
| Syntax | numeric := RandomSeed () |
|
Real |
| Purpose | Pass a value as an 8-byte float (DLL call in0line parameter function). See DLLCall. | ||
| Return Value | numeric | ||
| Syntax |
|
|
RegionAddListItem |
| Purpose |
Add an item to a list box, combination box, popup button, or custom control. The only way to add a list item to a custom control is with RegionAddListItem, or by sending the custom control a message. DialogAddListItem does not work on custom controls. Controls added with DialogAddControl are considered custom controls. The user is responsible for the use of these controls. |
||||||
| Examples | Appendix A: 8065 | ||||||
| Return Value | Index (position) of the added item, or the index of the last item in a repeating group if successful, or -1 if not. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegionAddListItemByIndex |
| Purpose |
Add an item to a list box, combination box, popup button, or custom control, at a specified index. Indexes are 1 based. The only way to add a list item to a custom control is with RegionAddListItem or RegionAddListItemByIndex, or by sending the custom control a message. DialogAddListItem does not work on custom controls. Controls added with DialogAddControl are considered custom controls. The user is responsible for the use of these controls. |
|||||||||
| Return Value | The index (position) of the added item. Indexes are 1 based. | |||||||||
| Syntax |
|
|||||||||
| Parameters |
|
|
RegionEnableWindow |
| Purpose | Enable or disable mouse and keyboard input to a dialog box or control. | ||||||||||||
| Examples | Appendix A: 8066 | ||||||||||||
| Return Value |
If State is left off, return the current state of the named region. If State is specified, return the previous state of the named region. |
||||||||||||
|
|||||||||||||
| Syntax |
|
||||||||||||
| Parameters |
|
|
RegionGetCheck |
| Purpose |
Report the state of a check box control. |
|||||||
| Examples | Appendix A: 8067 | |||||||
| Return Value |
|
|||||||
| Syntax |
|
|||||||
| Parameters |
|
|
RegionGetClass |
| Purpose | Return the class name (Windows) of a named region. | |||
| Examples | Appendix A: 8105 | |||
| Return Value |
Windows class name. |
|||
| Syntax |
|
|||
| Parameters |
|
|
RegionGetHandle |
| Purpose | Return the window handle of a named region. | |||
| Examples | Appendix A: 8095 | |||
| Return Value | If the named region does not exist, use OnError to handle error message. | |||
| Syntax |
|
|||
| Parameters |
|
|
RegionGetListContents |
| Purpose | Retrieve all the items in a specified list control. | ||||||
| Return Value | Text of items separated by the item separator. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegionGetListCount |
| Purpose | Return the number of items in a list or combo box, or pop-up button. | |||
| Examples | Appendix A: 8100 | |||
| Return Value | numeric | |||
| Syntax |
|
|||
| Parameters |
|
|
RegionGetListItem |
| Purpose | Return the index of an item in a list control. | ||||||
| Return Value | Index (position) of a list item, or -1 on error. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegionGetListItemByIndex |
| Purpose | Return an item from a list control by its index. | ||||||
| Return Value | List item text. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegionGetListSelectedCount |
| Purpose | Return count of the selected items in a list box, combination box, or custom control. | |||
| Return Value | The number of selected items. | |||
| Syntax |
|
|||
| Parameters |
|
|
RegionGetModified |
| Purpose | Determine whether an edit control's contents have been modified (DialogAddCounter, DialogAddDate, DialogAddEditBox, DialogAddFilenameBox). See RegionSetModified. | |||
| Examples | Appendix A: 8101 | |||
| Return Value |
True if an edit control has been modified, False if not. |
|||
| Syntax |
|
|||
| Parameters |
|
|
RegionGetPosition |
| Purpose |
Returns size and position information about a named region. Missing optional parameters are not returned. |
|||||||||||||||||||||
| Return Value | True if the specified region exists, False if not. | |||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||
| Parameters |
|
|
RegionGetSelectedText |
| Purpose | Returns selected text in a control such as a list box, combination box, or counter. To return a control's full text use RegionGetWindowText. | ||||||
| Examples | Appendix A: 8068 | ||||||
| Return Value | Selected text. If no text is selected, an empty string ("") is returned. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegionGetWindowText |
| Purpose | Get caption bar, static text, or edit box text. | |||
| Examples | Appendix A: 8069 | |||
| Return Value | Specified text. | |||
| Syntax |
|
|||
| Parameters |
|
|
RegionIsEnabled |
| Purpose | Indicates whether a specified region is enabled. | |||
| Return Value | True if the named region is enabled, False if not. | |||
| Syntax |
|
|||
| Parameters |
|
|
RegionIsVisible |
| Purpose | Determine the visibility state of a region or window. | |||
| Examples | Appendix A: 8094 | |||
| Return Value | True if visible, False if not. Window's WS_VISIBLE flag determines the return value, which can be nonzero even if the window is hidden by other windows. See your Windows 95 documentation for more information. | |||
| Syntax |
|
|||
| Parameters |
|
|
RegionMoveWindow |
| Purpose | Move and/or resize a dialog box or control. | |||||||||||||||||||||||||||||
| Examples | Appendix A: 8070 | |||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||
| Parameters |
|
|
RegionRemoveListItem |
| Purpose | Remove a list item from a list box, combination box, or pop-up button. Exact match items are removed before partial match items. | ||||||
| Examples | Appendix A: 8071 | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegionRemoveListItemByIndex |
| Purpose | Remove an item from a list control by its index. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegionResetList |
| Purpose | Clear the contents of a list box, combination box, or pop-up button. | |||
| Examples | Appendix A: 8072 | |||
| Syntax |
|
|||
| Parameters |
|
|
RegionSelectListItem |
| Purpose | Select an item in a list box, combination box, or pop-up button. | ||||||||||||||||||
| Examples | Appendix A: 8073 | ||||||||||||||||||
| Return Value | Return the index (1-based) of the selected item. | ||||||||||||||||||
| Syntax |
|
||||||||||||||||||
| Parameters |
|
|
RegionSelectListItemByIndex |
| Purpose | Select an item in a list control by its index. | ||||||||||||||||||
| Return Value | The selected item. | ||||||||||||||||||
| Syntax |
|
||||||||||||||||||
| Parameters |
|
|
RegionSetBitmap |
| Purpose |
Set a bitmap file in a bitmap control. This token replaces RegionSetBitmapFilename, and adds the ability to use a bitmap in a DLL or EXE. |
|||||||||
| Examples | Appendix A: 8104 | |||||||||
| Syntax |
|
|||||||||
| Parameters |
|
|
RegionSetCheck |
| Purpose | Select/deselect a check box. | ||||||||||||||||||||||||
| Examples | Appendix A: 8074 | ||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||
| Parameters |
|
|
RegionSetEditSelection |
| Purpose | Select the text or a portion of text in a text edit control. | |||||||||
| Syntax |
|
|||||||||
| Parameters |
|
|
RegionSetFocus |
| Purpose | Give input focus to a specified control. | |||
| Examples | Appendix A: 8075 | |||
| Return Value | Window handle of the region that used to have focus, or NULL if not successful. | |||
| Syntax |
|
|||
| Parameters |
|
|
RegionSetModified |
| Purpose | Set the modified state of an edit control (DialogAddCounter, DialogAddDate, DialogAddEditBox, DialogAddFilenameBox). See RegionGetModified. | ||||||||||
| Examples | Appendix A: 8103 | ||||||||||
| Syntax |
|
||||||||||
| Parameters |
|
|
RegionSetProgressPercent |
| Purpose | Set the percentage to display in a progress control. See DialogAddProgress. | ||||||
| Examples | Appendix A: 8098 | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegionSetSelectedText |
| Purpose | Set the selected text of a named region. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegionSetWindowText |
| Purpose | Replace caption bar, static text, or edit box text. | ||||||
| Examples | Appendix A: 8076 | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegionShowWindow |
| Purpose | Show/hide a dialog box or control. | ||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8077 | ||||||||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||||||||
| Parameters |
|
|
RegistryCloseKey |
| Purpose | Close an open key in the Windows Registry. | |||
| Examples |
|
|||
| Return Value | Return 0 if successful, an error code if not. | |||
| Syntax |
|
|||
| Parameters |
|
|
RegistryCreateKey |
| Purpose | Create or open a key in the Windows Registry. | ||||||||||||||||||||||||||
| Examples |
|
||||||||||||||||||||||||||
| Return Value | Window handle of a created key. | ||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||
| Parameters |
|
|
RegistryDeleteKey |
| Purpose |
Delete a key from the Windows Registry. |
||||||
| Examples |
|
||||||
| Return Value | Return 0 if successful, an error code if not. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegistryDeleteValue |
| Purpose |
Delete a value from the Windows Registry. |
||||||
| Examples |
|
||||||
| Return Value | Return 0 if successful, an error code if not. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
RegistryEnumKey |
| Purpose | Enumerate a key from the Windows Registry. | |||||
| Examples |
|
|||||
| Return Value | Subkey number. | |||||
| Syntax |
|
|||||
| Parameters |
|
|
RegistryEnumValue |
| Purpose |
Enumerate a value from the Windows Registry. |
||||
| Examples |
|
||||
| Return Value | string | ||||
| Syntax |
|
||||
| Parameters |
|
|
RegistryOpenKey |
| Purpose | Open a key in the Windows Registry. | |||||||||||||||||||||||||
| Examples |
|
|||||||||||||||||||||||||
| Return Value | Handle of the opened key if successful, an error code if not. | |||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||
| Parameters |
|
|
RegistryQueryKeyCount |
| Purpose |
Get the count of subkeys under a key in the Windows Registry. |
|||
| Examples |
|
|||
|
Return Valuecount. |
||||
| Syntax |
|
|||
| Parameters |
|
|
RegistryQueryLastError |
| Purpose | Return the last error code. |
| Examples |
|
| Return Value | Error code, or 0 if none available. |
| Syntax | numeric := RegistryQueryLastError () |
|
RegistryQueryValue |
| Purpose | Obtain a value from the Windows Registry. | |||||||
| Examples |
|
|||||||
| Return Value | Windows Registry value. | |||||||
| Syntax |
|
|||||||
| Parameters |
|
|
RegistryQueryValueCount |
| Purpose | Return the count of values under a key in the Windows Registry. | ||
| Examples |
|
||
| Return Value | Count of values under a Windows Registry key. | ||
| Syntax |
|
||
| Parameters |
|
|
RegistrySetValue |
| Purpose | Save a value in the Windows Registry. | |||||||||||||||||||||||||||||||||||||||||||||
| Examples |
|
|||||||||||||||||||||||||||||||||||||||||||||
| Return Value | numeric | |||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
RenameDirectory |
| Purpose | Rename a directory. | ||||||||||||||
| Examples | Appendix A: 8081 | ||||||||||||||
| Return Value | Return True if successful, False if not. | ||||||||||||||
| Syntax |
|
||||||||||||||
| Parameters |
|
|
RenameFile |
| Purpose | Rename and/or move a file. | ||||||||||||||
| Examples | Appendix A: 8087 | ||||||||||||||
| Return Value |
Return True if successful, False if not. |
||||||||||||||
| Syntax |
|
||||||||||||||
| Parameters |
|
|
Repeat |
| Purpose |
A loop statement that executes until the expression at the bottom of the loop is true (see Loop Statements in Chapter 5: Conditional, Loop, and Calling Statements). The loop executes at least once, because it is not tested until the bottom of the loop. When <Test> is true, the first statement after Until is executed. |
|||
| Examples |
Appendix A: 8004 The general form of a Repeat statement is:
|
|||
| Syntax |
Repeat
...<statement block> Until (<Test> boolean) |
|||
| Parameters |
|
|
Return |
| Purpose |
End Label, Function, and Procedure subroutines, or a macro (see Run), and then directs macro execution to the statement that follows the subroutine or macro's caller. Return generally ends a Label statement called by statements such as Call or Case Call.
If there is no caller to return to, and the macro containing Return is nested (called by another macro), Return directs macro execution to the statement that follows the macro's caller (see Run). Return ends a macro if there is no caller to return to, and the macro containing the Return statement is not nested. |
|||
| Examples | Appendix A: 8007 | |||
| Syntax |
|
|||
| Parameters |
|
|
Return |
| Purpose |
End Label, Function, and Procedure subroutines, or a macro (see Run), and then directs macro execution to the statement that follows the subroutine or macro's caller, or creates a Cancel, Error, or Not Found condition. Return generally ends a Label statement called by statements such as Call or Case Call.
If there is no caller to return to, and the macro containing Return is nested (called by another macro), Return directs macro execution to the statement that follows the macro's caller (see Run). Return ends a macro if there is no caller to return to, and the macro containing the Return statement is not nested. |
|||||||||||||||
| Syntax |
|
|||||||||||||||
| Parameters |
|
|
RoundOff |
| Purpose |
Get a value rounded to a value. vResult := RoundOff(12.63; 0.75) Result: vResult equals 12.75 |
||||||
| Return Value | Rounded value. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
Run |
| Purpose |
Call (start) a nested macro. A nested macro starts immediately when it is called. When a nested macro ends, control returns to the calling macro. If Quit ends a nested macro, control does not return to the calling macro. PerfectScript automatically compiles uncompiled Run macros. Macro execution stops if the macro will not compile. |
||||||
| Examples | Appendix A: 8010 | ||||||
| Syntax |
|
||||||
| Parameters |
|