Purpose: | Display a Windows message box |
Format: | MSGBOX [/1["text"] /2["text"] /3["text"] /4["text"] /5["text"] /6["text"] /Brgb /Dn /H /I /L /M /N /O /Px,y /Pc /Q /R /S /Tn /W /X] buttontype ["title"] prompt |
buttontype | One of OK, OKCANCEL, YESNO, YESNOCANCEL, RETRYCANCEL, ABORTRETRYIGNORE, CANCELTRYCONTINUE, CONTINUEABORT, SKIPSKIPALLCANCEL, or IGNOREIGNOREALLCANCEL |
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-RT will automatically size and center the message box on the tab window (if TCC is running in a Take Command), or centered on the screen (if TCC-RT is running in a console window). 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 |
|
SKIPSKIPALLCANCEL |
Skip |
Skip All |
Cancel |
IGNOREIGNOREALLCANCEL |
Ignore |
Ignore All |
Cancel |
There are two button type modifiers (only valid when used immediately following a YESNO or YESNOCANCEL):
YESTOALL - adds a "Yes to All" button (returns 30)
NOTOALL - adds a "No to All" button (returns 31)
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 |
custom button 5 |
25 |
custom button 6 |
26 |
If you define custom buttons, the button type argument will be ignored.
There are three optional Checkbox types. (You can only choose one at a time.)
DONOTASKAGAIN - add checkbox "Do not ask me again".
DONOTTELLAGAIN - add checkbox "Do not tell me again"
DONOTSHOWAGAIN - add checkbox "Do not show again"
If the checkbox is selected, MSGBOX will set the internal variable %_msgbox_checkbox to 1.
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.
You can copy the text in a MSGBOX window to the clipboard by entering Ctrl-C when the MSGBOX window has the keyboard focus.
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. |
/5 | If there is a text string following the option, set the custom text for the fifth button. Otherwise, set the fifth button as the default. |
/6 | If there is a text string following the option, set the custom text for the sixth button. Otherwise, set the sixth button as the default. |
/L | Limit the maximum message box width to no more than 1/3 the screen width (unless the button text requires more). |
/Px,y | The initial x,y screen coordinates. If you don't use this option, MSGBOX will center its window in the Take Command tab window or the TCC-RT console window. |