MSGBOX |
|
| Purpose: | Display a Windows message box |
| Format: | MSGBOX [/1["text"] /2["text"] /3["text"] /4["text"] /Dn /H /I /M /N /O /Px,y /Q /R /S /Tn /W] buttontype ["title"] prompt |
| buttontype | One of OK, OKCANCEL, YESNO, YESNOCANCEL, RETRYCANCEL, ABORTRETRYIGNORE, CANCELTRYCONTINUE, or CONTINUEABORT |
| title | Text for the title bar of the message box. |
| prompt | Text that will appear inside the message box. |
See also: INKEY, INPUT, QUERYBOX, and TASKDIALOG.
Usage:
MSGBOX can display one of eight kinds of message boxes and wait for the user's response. You can use title and prompt to display any text you wish. TCC will automatically size and center the message box on the screen. The message box has up to three response buttons (plus an optional Help button), depending on its type, as shown below.
buttontype |
button 1 |
button 2 |
button 3 |
OK |
OK |
|
|
OKCANCEL |
OK |
Cancel |
|
YESNO |
Yes |
No |
|
YESNOCANCEL |
Yes |
No |
Cancel |
RETRYCANCEL |
Retry |
Cancel |
|
ABORTRETRYIGNORE |
Abort |
Retry |
Ignore |
CANCELTRYCONTINUE |
Cancel |
Try Again |
Continue |
CONTINUEABORT |
Continue |
Abort |
|
If the standard message box types don't meet your needs, you can create a custom message box with up to four buttons (plus an optional Help button), specifying the text that appears on each button.
The button the user chooses is indicated using the internal variable %_?. Be sure to save the return value in another variable or test it immediately; because the value of %_? changes with every internal command. The following list shows the value returned for each selection:
response |
|
Yes or OK |
10 |
No |
11 |
Cancel |
12 |
Retry |
13 |
Try Again |
14 |
Continue |
15 |
Ignore |
16 |
Abort |
17 |
Help |
18 |
timeout |
20 |
custom button 1 |
21 |
custom button 2 |
22 |
custom button 3 |
23 |
custom button 4 |
24 |
If you define custom buttons, the button type argument will be ignored.
If there is an error in the MSGBOX command itself, %_? will be set as described in its documentation (see _?).
For example, to display a Yes or No message box and take action depending on the result, you could use commands like this:
msgbox yesno "Copy" Copy all files to A:?
if %_? == 10 copy * a:
Since MSGBOX doesn't write to standard output, it disables redirection and piping to allow you to enter the redirection characters (<, >, and |) in your prompt text.
MSGBOX creates a popup dialog box. If you prefer to retrieve input from the command line, see the INKEY and INPUT commands.
Options:
| /1 | If there is a text string following the option, set the custom text for the first button. Otherwise, set the first button as the default. |
| /2 | If there is a text string following the option, set the custom text for the second button. Otherwise, set the second button as the default. |
| /3 | If there is a text string following the option, set the custom text for the third button. Otherwise, set the third button as the default. |
| /4 | If there is a text string following the option, set the custom text for the fourth button. Otherwise, set the fourth button as the default. |
| /Px,y | The initial x,y screen coordinates. If you don't use this option, MSGBOX will center its window in the TCC tab window. |
| /Tn | MSGBOX will wait a maximum of n seconds for a response. If the time limit expires, %_? will be set to 20. The time remaining before the window closes will be displayed in the default button. |