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.
|
MacroArgs[ ] |
| Purpose |
An array variable that contains parameter arguments passed to it by Chain, Nest, or Run, or on the command line with the /m- option.
Result: x y z |
| Syntax | any := MacroArgs[<Index> numeric] |
|
MacroDialogResult |
| Purpose |
MacroDialogResult is a predefined macro variable that is updated to reflect the status of the Dialog commands. These commands are functions that mostly return the same value placed into MacroDialogResult. The list of commands below are followed by the values placed into MacroDialogResult if successful or if not successful. Command Name: successful / not successful DialogDefine: dialog name / empty string ("") DialogDestroy: True / False DialogShow (callback dialog): dialog handle / 0 DialogShow (non-callback): control name / empty string ("") The return value for this command is different when the control is the OK or Cancel control. MacroDialogResult returns "1" for OK, and "2" for Cancel. This command returns "OKBttn" and "CancelBttn". DialogDisplay: True / False DialogDismiss: control name / empty string ("") See the description of the non-callback DialogShow command above. DialogUndisplay: True / False DialogHandle: dialog handle / 0 DialogLoad: dialog handle / 0 DialogSave: True / False DialogDelete: True / False DoesDialogExist: True / False DialogSetProperties: True/ False DialogControlUpdate: True/ False DialogControlQuery: True / False DialogAddListItem: item index / -1 All the following commands return the control name if successful, an empty string ("") if not: DialogAddBitmap DialogAddCheckBox DialogAddColorWheel DialogAddComboBox DialogAddControl DialogAddCounter DialogAddDate DialogAddEditBox DialogAddFileNameBox DialogAddFrame DialogAddGroupBox DialogAddHLine DialogAddHotSpot DialogAddIcon DialogAddListBox DialogAddPopupButton DialogAddProgress DialogAddPushButton DialogAddRadioButton DialogAddScrollBar DialogAddText DialogAddViewer DialogAddVLine |
| Syntax | string := MacroDialogResult |
|
MacroInfo |
| Purpose |
Return information about the system, the state of a macro, or a label or routine within a macro. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | any depending on the information requested. For example, string if the platform name is requested, or numeric if the platform version is requested. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Discussion |
The macro system keeps track of called labels and routines, the data that is specific to each one, and the call depth of each one. If the main section of a macro calls label "A" which calls procedure "B" which calls function "C", the following is true: Call depth is 2 (call depth is 0 when the macro starts), and the data for A, B, and C is maintained by the macro system. The current label/routine is C. If data for C is needed, specify CallLevel as Current!. If data for B is needed, specify CallLevel as Previous! (B was the routine that called C). If data for A is needed, specify CallLevel as Previous! + 1. Whenever data is needed for a routine before Previous!, specify CallLevel as Previous! + 1, Previous + 2, and so forth. You may also specify a numeric value for CallLevel parameters, which simplifies getting data on all active label or routine calls using a For loop. For example, specify Current! as Previous! as 3, and so forth. Start the loop at 0, and use MacroInfo (CallDepth!) to end the loop at the call depth return value. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MantissaPart |
| Purpose |
Get the mantissa portion of a numeric value. vMntsa := MantissaPart(3.2e18) Result: vMntsa = 3.2 |
|||
| Return Value | Mantissa portioin of a numeric value. | |||
| Syntax |
|
|||
| Parameters |
|
|
Max |
| Purpose | Get the maximum value of a list of values. | |||
| Return Value | Maximum value of a list of values. | |||
| Syntax |
|
|||
| Parameters |
|
|
Menu |
| Purpose |
Display a menu of user-defined items. Menu is used with statements such as Case, Case Call, and If to execute a statement that corresponds to a selected menu item. To dismiss a menu, press Alt or Esc. |
|||||||||||||||||||||
| Examples | Appendix A: 8002 | |||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||
| Parameters |
|
|
MenuList |
| Purpose |
Display a menu of user-defined items. This command is included for DOS compatibility. The Windows equivalent is Menu. MenuList is used with statements such as Case, Case Call, and If to execute a statement that corresponds to a selected menu item. To dismiss a menu, press Alt or Esc. |
|||||||||||||||
| Examples | Appendix A: 8002 | |||||||||||||||
| Syntax |
|
|||||||||||||||
| Parameters |
|
|
MessageBox |
| Purpose |
Display a message box. Provide a limited set of buttons and icons, and an option to include up to 10 different parameter strings in the message. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8011 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | The control value of the button that dismisses the message box is returned in this variable. The return button values are: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Min |
| Purpose |
Get the minimum value of a list of values. |
|||
| Return Value | Minimum value of a list of values. | |||
| Syntax |
|
|||
| Parameters |
|
|
MMPlay |
| Purpose |
Play a sound file. Play a audio (WAV) file, an Audio-Visual Interleave (AVI) movie file, or a Musical Instrument Digital Interface (MIDI) file, or speaks an ASCII text file (see MMSpeak). Speech requires text-to-speech drivers like those shipped with some sound boards. Audio and MIDI files require the appropriate sound card. |
||||||||||||
| Examples | Appendix A: 8025 | ||||||||||||
| Return Value | A handle that can be passed to MMStopPlay. | ||||||||||||
| Syntax |
|
||||||||||||
| Parameters |
|
|
MMSpeak |
| Purpose | Speak an ASCII file or ASCII text. | |||
| Examples | Appendix A: 8026 | |||
| Syntax |
|
|||
| Parameters |
|
|
MMSpeakClipboard |
| Purpose |
Speak text saved to the Clipboard. A text-to-speech driver must be installed. Products supported are: Lernout and Hauspie, Centigram TruVoice, and the Creative TextAssist. |
| Examples | Appendix A: 8026 |
| Syntax | MMSpeakClipboard () |
|
MMStopPlay |
| Purpose | Stop a multimedia file started with MMPlay, with the DontWait! option set. With the Wait! option set, MMStopPlay has no effect. | |||
| Syntax |
|
|||
| Parameters |
|
|
MMStopSpeech |
| Purpose |
Stop a speech (text) file started with MMPlay (ASCII file), MMSpeak, or MMSpeakClipboard. After a text file begins to speak, control immediately returns to the macro. Use MMStopSpeech to stop speaking a text file. |
| Examples | Appendix A: 8026 |
| Syntax | MMStopSpeech () |
|
MOD |
| Purpose | Operator. Precedence level 3. See Arithmetic Operators in Chapter 4: Expressions. |
| Return Value | Return the integer remainder of the quotient of two numbers. |
| Syntax | numeric := numeric MOD numeric |