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.
|
DialogAddBitmap |
| Purpose | Add a bitmap control to a dialog box. After DialogLoad or DialogShow, bitmap controls can be added to a dialog created with the Dialog Editor. | ||||||||||||||||||||||||||||||||||||
| Examples |
|
||||||||||||||||||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. This same value is placed into the MacroDialogResult variable. | ||||||||||||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddCheckBox |
| Purpose | Add a check box control to a dialog box. After DialogLoad or DialogShow, a check box can be added to a dialog created with the Dialog Editor. | ||||||||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8041 | ||||||||||||||||||||||||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | ||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddColorWheel |
| Purpose |
Add a color wheel control to a dialog box, and return a number that represents the selected color when the dialog is dismissed. After DialogShow or DialogLoad, a color wheel can be added to a dialog created with the Dialog Editor. The color selection consists of three color elements (red, green, and blue), separated into color values by the formula given below (see the MacroVar parameter below). These values are used in Windows programming to specify the color of a pen or brush. |
|||||||||||||||||||||
| Examples | Appendix A: 8043 | |||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. This same value is placed into the MacroDialogResult variable. | |||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||
| Parameters |
|
|
DialogAddComboBox |
| Purpose |
Add a combo box control to a dialog box. After DialogShow or DialogLoad, a combo box can be added to a dialog created with the Dialog Editor. The combo box displays an edit box and a list box. You enter text in the edit box, or double-click a list item to insert it. Use DialogAddListItem to create list box items. |
|||||||||||||||||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8043 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | Name of the item added to the combo box control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddControl |
| Purpose |
Add a custom control to a dialog box. After DialogShow or DialogLoad, a custom control can be added to a dialog created with the Dialog Editor. The macro system knows nothing about custom controls. The user is responsible for all control message processing and queries. |
|||||||||||||||||||||||||||||||||
| Return Value | Name of the control added to the dialog box if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddCounter |
| Purpose |
Add a counter control to a dialog box. After DialogShow or DialogLoad, a counter can be added to a dialog created with the Dialog Editor. Click the counter button to insert a number in the edit box that is within a specified range (see the CountMin and CountMax parameters below). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8043 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. This same value is placed into the MacroDialogResult variable. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddDate |
| Purpose | Add a date to a dialog box. After DialogShow or DialogLoad, a date can be added to a dialog created with the Dialog Editor. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8097 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | Date added to the dialog box if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddEditBox |
| Purpose |
Add an edit control to a dialog box. After DialogShow, an edit box can be added to a dialog created with the Dialog Editor. The text entered in the edit box is returned in MacroVar when the dialog is dismissed (see MacroVar parameter). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8046 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddFileNameBox |
| Purpose |
Add a filename edit control to a dialog box. After DialogShow or DialogLoad, a filename box can be added to a dialog created with the Dialog Editor. The filename edit control consists of an edit control and a button control. Clicking the button displays the Select Directory or Select File dialog box depending on the control style (see the Style parameter). |
||||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8046 | ||||||||||||||||||||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | ||||||||||||||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddFrame |
| Purpose |
Add a frame to a dialog box. After DialogShow or DialogLoad, a frame can be added to a dialog created with the Dialog Editor. You can combine frame styles by creating two frames the same size and at the same position. For example, you can create a black frame and a white-filled frame (see the Control and Style parameters). You can also create custom controls by combining frames and QuickSpots (see DialogAddHotSpot and DialogShow). |
||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8047 | ||||||||||||||||||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | ||||||||||||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddGroupBox |
| Purpose |
Draw a rectangle around related dialog controls such as buttons. After DialogShow or DialogLoad, a group box can be added to a dialog created with the Dialog Editor. Grouping related controls helps narrow user options. |
|||||||||||||||||||||
| Examples | Appendix A: 8048 | |||||||||||||||||||||
| Return Value |
Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. |
|||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||
| Parameters |
|
|
DialogAddHLine |
| Purpose |
Add a horizontal line to a dialog box. After DialogShow or DialogLoad, a horizontal line can be added to a dialog created with the Dialog Editor. |
|||||||||||||||
| Examples | Appendix A: 8048 | |||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||
| Syntax |
|
|||||||||||||||
| Parameters |
|
|
DialogAddHotSpot |
| Purpose |
Create an invisible area (QuickSpot) in a dialog box that closes the dialog box when clicked. After DialogShow or DialogLoad, a QuickSpot can be added to a dialog created with the Dialog Editor. Other responses are possible when you use DialogAddHotSpot with a callback function (see DialogShow). To create a QuickSpot within a frame (see DialogAddFrame), overlap size and position parameters. |
|||||||||||||||||||||||||||
| Examples | Appendix A: 8045 | |||||||||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddIcon |
| Purpose | Add an icon to a dialog box. After DialogShow or DialogLoad, an icon can be added to a dialog created with the Dialog Editor. | ||||||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | ||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||
| Parameters |
|
|
DialogAddListBox |
| Purpose |
Add a list box control to a dialog box. After DialogShow or DialogLoad, a list box can be added to a dialog created with the Dialog Editor. The item you choose is returned in MacroVar (see the MacroVar parameter). Use DialogAddListItem to create list box items. |
||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddListItem |
| Purpose | Creates a list item(s) for DialogAddComboBox and DialogAddListBox. After DialogShow, a list item(s) can be added to a list box in a dialog created with the Dialog Editor. | |||||||||
| Examples | Appendix A: 8049 | |||||||||
| Return Value | Index (position) where the item was added to the list if successful, or -1 if not. The same result is placed into the MacroDialogResult variable. | |||||||||
| Syntax |
|
|||||||||
| Parameters |
|
|
DialogAddProgress |
| Purpose | Add a progress indicator to a dialog box. After DialogShow or DialogLoad, a progress indicator control can be added to a dialog created with the Dialog Editor. See RegionSetProgressPercent. | ||||||||||||||||||
| Examples | Appendix A: 8098 | ||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | ||||||||||||||||||
| Syntax |
|
||||||||||||||||||
| Parameters |
|
|
DialogAddPushButton |
| Purpose |
Add a push button to a dialog box. After DialogShow or DialogLoad, a push button can be added to a dialog created with the Dialog Editor. When you choose a user-defined push button or QuickSpot, the Control parameter value of the button or QuickSpot is returned in the implicit variable MacroDialogResult (see DialogDefine). Other controls return the following Control parameter values: 1 for OK, 2 for Cancel, 2 for Close (system menu box), 2 if you double-click the system menu box, 2 if you press Alt+F4 or Esc. |
|||||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8048 | |||||||||||||||||||||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddRadioButton |
| Purpose |
Add a radio button to a dialog box. After DialogShow or DialogLoad, a radio button can be added to a dialog created with the Dialog Editor. Radio buttons represent mutually exclusive choices. Selecting one radio button deselects another. Group them together by a control such as a group box or horizontal or vertical line. For multiple selections, see DialogAddCheckBox. |
||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8048 | ||||||||||||||||||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | ||||||||||||||||||||||||||||||||||||
| Syntax |
|
||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddScrollBar |
| Purpose |
Adds a horizontal or vertical scroll bar to a dialog box. After DialogShow or DialogLoad, a scroll bar can be added to a dialog created with the Dialog Editor. A callback function (see DialogShow) can receive Windows WM_HSCROLL and WM_VSCROLL messages from DialogAddScrollBar. For more information, refer to your Windows documentation. |
|||||||||||||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8050 | |||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | Name that identifies the scroll bar control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddText |
| Purpose | Display a line of text in a dialog box. After DialogShow or DialogLoad, text can be added to a dialog created with the Dialog Editor. | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8041 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | Text added to the dialog box if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogAddViewer |
| Purpose | Add a window to a dialog box for viewing files. The contents of the specified file are displayed in the viewer. | |||||||||||||||||||||
| Examples | Appendix A: 8046 | |||||||||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||
| Parameters |
|
|
DialogAddVLine |
| Purpose | Add a vertical line to a dialog box. After DialogShow or DialogLoad, a vertical line can be added to a dialog created with the Dialog Editor. | |||||||||||||||
| Examples | Appendix A: 8048 | |||||||||||||||
| Return Value | Name of the control if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||
| Syntax |
|
|||||||||||||||
| Parameters |
|
|
DialogControlQuery |
| Purpose | Get the value of a control, or of all controls in a dialog. | |||||||||
| Return Value | True if successful, False if not. | |||||||||
| Syntax |
|
|||||||||
| Parameters |
|
|
DialogControlUpdate |
| Purpose | Update a dialog control or controls from a value. | |||||||||
| Return Value | True if successful, False if not. | |||||||||
| Syntax |
|
|||||||||
| Parameters |
|
|
DialogDefine |
| Purpose |
Assemble dialog data in memory. Use DialogShow to create and display the dialog box. Dialog names are limited to 25 characters. Dialog sizes do not include caption and border space (in Windows 95, dialog captions and borders can be sized by the user). The value of the control that dismisses a dialog box is returned in an implicit variable named MacroDialogResult: 1 for OK, 2 for Cancel, 2 for Close (system menu box), 2 if you double-click the system menu box, 2 if you press Alt+F4 or Esc. It also returns the value of the Control parameter of a user-defined push button or QuickSpot (see DialogAddPushButton and DialogAddHotSpot). MacroDialogResult is replaced or destroyed when you close a dialog box or call DialogDestroy. To save its value, assign it to a variable. For example, vResult := MacroDialogResult. Dialog boxes are positioned and sized in dialog units. A vertical unit equals 1/8 of the font height, and a horizontal unit equals 1/4 of the font width. |
|||||||||||||||||||||||||||||||||||||||||||||||
| Examples | Appendix A: 8041 | |||||||||||||||||||||||||||||||||||||||||||||||
| Return Value | Name of the dialog if successful, an empty string ("") if not. The same result is placed into the MacroDialogResult variable. | |||||||||||||||||||||||||||||||||||||||||||||||
| Syntax |
|
|||||||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
|
DialogDelete |
| Purpose |
Delete a (binary form) dialog from the prefix packet area of the current macro file. |
|||
| Return Value | Return True if successful, False if not. | |||
| Syntax |
|
|||
| Parameters |
|
|
DialogDestroy |
| Purpose | Remove an old-style dialog box from memory. | |||
| Examples | Appendix A: 8041 | |||
|
Discussion |
A dialog created with the Dialog Editor, without a callback (see DialogShow), is removed from memory when any button is pushed. Subsequent calls to the dialog create an error (the macro system no longer knows anything about the dialog). For example, DialogDismiss in
creates an error when OK is pressed (Dialog1). The next example, which includes a callback function, displays the dialog, continuously executes instructions (callback function "CallHere"), is dismissed (hidden), and is finally destroyed.
|
|||
| Return Value | True if successful, False if not. This same value is placed in MacroDialogResult. | |||
| Syntax |
|
|||
| Parameters |
|
|
DialogDismiss |
| Purpose | Hide a dialog box. Use DialogShow to display a hidden dialog box. | ||||||
| Examples | Appendix A: 8094 | ||||||
|
Discussion |
A dialog created with the Dialog Editor, without a callback (see DialogShow), is removed from memory when any button is pushed. Subsequent calls to the dialog create an error (the macro system no longer knows anything about the dialog). For example, DialogDismiss in
creates an error when OK is pressed (Dialog1). The next example, which includes a callback function, displays the dialog, continuously executes instructions (callback function "CallHere"), is dismissed (hidden), and is finally destroyed.
|
||||||
| Return Value | Name of the button control used to dismiss a dialog, which can be slightly different than the value placed in MacroDialogResult. If the button used to dismiss a dialog is OK, 1 is placed in MacroDialogResult, or 2 if the button is Cancel. DialogDismiss returns "OKBttn" or "CancelBttn." If the button is not OK or Cancel, the name of the control is placed into MacroDialogResult, and returned from DialogDismiss. If an error occurs, an empty string ("") is returned. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
DialogHandle |
| Purpose | Return the handle of a dialog or dialog box control. | ||||||
| Examples | Appendix A: 8051 | ||||||
| Return Value | Handle of a dialog or dialog box control. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
DialogLoad |
| Purpose | Load a dialog in memory without displaying it. You can use Region commands on a dialog box that has been loaded. See also DialogShow and Discussion under DialogDismiss. | ||||||
| Examples | Appendix A: 8041 | ||||||
| Return Value | The window handle if successful, or 0 if not. | ||||||
| Syntax |
|
||||||
| Parameters |
|
|
DialogSave |
| Purpose | Save the specified dialog as a binary form dialog in the prefix packet area of the current macro file. | |||||||
| Return Value | True if saved successfully, False if not. | |||||||
| Syntax |
|
|||||||
| Parameters |
|
|
DialogSetProperties |
| Purpose |
Specify additional properties for a dialog box. This command should be used only on dialogs created with DialogDefine. It should be called immediately after DialogDefine.
|
||||||||||||||||||
| Return Value | True if successful, False if not. | ||||||||||||||||||
| Syntax |
|
||||||||||||||||||
| Parameters |
|
|
DialogShow |
| Purpose |
Display a dialog box, and, optionally, identify a callback function. Use DialogDismiss to hide a dialog box. See Discussion under DialogDismiss or DialogDestroy. A callback function enables a macro to respond immediately and in specific ways to events such as selecting a radio button or check box, without waiting until the dialog box is dismissed. Without a callback function, user input is acted upon only after the dialog box is dismissed and the macro resumes execution. To create a callback function, use the Label parameter of DialogShow, and a loop statement after DialogShow. For example,
The value of the control that dismisses a dialog box is returned in an implicit variable named MacroDialogResult: 1 for OK, 2 for Cancel, 2 for Close (system menu box), 2 if you double-click the system menu box, 2 if you press Alt+F4, or the value of the Control parameter of a user-defined push button or QuickSpot (see DialogAddPushButton and DialogAddHotSpot). If DialogShow is used with Dialog commands, such as DialogDefine and DialogAddEitBox (old- style dialog box), the first control that can return a value has the input focus. If a dialog is preloaded through DialogLoad or a Region command, the Parent parameter of DialogDefine is not used (the dialog is already created or "parented"). Before loading a dialog through a Region command, use DialogLoad to specify the parent. |
||||||||||||
| Examples | Appendix A: 8094 | ||||||||||||
| Return Value |
If DialogShow is used to display a callback dialog, the window handle of
the dialog is returned (the same value placed into MacroDialogResult),
and returned from DialogShow. If an error occurs, 0 is returned.
If DialogShow is used to display a non-callback dialog, the button control used to dismiss the dialog is returned, which can be slightly different from the value placed in MacroDialogResult. If the button used to dismiss the dialog is OK, 1 is placed in MacroDialogResult, or 2 if the button is Cancel. DialogShow returns "OKBttn" or "CancelBttn." If the button is not OK or Cancel, the name of the control is placed into MacroDialogResult. If an error occurs, an empty string ("") is returned. |
||||||||||||
| Syntax |
|
||||||||||||
| Parameters |
|