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

 

buttontypeOne of OK, OKCANCEL, YESNO, YESNOCANCEL, RETRYCANCEL, ABORTRETRYIGNORE, CANCELTRYCONTINUE, CONTINUEABORT, SKIPSKIPALLCANCEL, or IGNOREIGNOREALLCANCEL
titleText for the title bar of the message box.
promptText that will appear inside the message box.

 

/1 (st button)/M (system modal)
/2 (nd button)/N (no sound)        
/3 (rd button) /O (topmost window)
/4 (th button)/P (screen coordinates)        
/5 (th button)/Pc (center)
/6 (th button)/Q(uestion icon)
/B (background color)/R(ight justify buttons)        
/F (foreground color)/S(top icon)
/D(isable temporarily)/T(imeout)                
/H(elp button)/W(arning icon)
/I(nformation icon)/X (not moveable)
/L(imit width)

 

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 tab window (if TCC is running in a Take Command), or centered on the screen (if TCC 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:

 

/=Display the MSGBOX command dialog to help you set the command line options. The /= option can be anywhere on the line; additional options will set the appropriate fields in the command dialog.

 

/1If 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.

 

/3If there is a text string following the option, set the custom text for the third button. Otherwise, set the third button as the default.

 

/4If there is a text string following the option, set the custom text for the fourth button. Otherwise, set the fourth button as the default.

 

/5If there is a text string following the option, set the custom text for the fifth button. Otherwise, set the fifth button as the default.

 

/6If there is a text string following the option, set the custom text for the sixth button. Otherwise, set the sixth button as the default.

 

/BrgbBackground color, as a hex number where Blue is the most significant 2 bytes, Green the middle two, and Red the least significant. For example, /BAA8866 will set Blue to AA, Green to 88, and Red to 66.

 

/DnDisable the message box buttons for n seconds at startup.

 

/FrgbText color, as a hex number where Blue is the most significant 2 bytes, Green the middle two, and Red the least significant. For example, /FAA8866 will set Blue to AA, Green to 88, and Red to 66.

 

/HDisplay a help button.

 

/IDisplay an icon consisting of a lower case "i" in a circle in the message box.

 

/LLimit the maximum message box width to no more than 1/3 the screen width (unless the button text requires more).

 

/MThe message box window will be displayed on top of all other windows.

 

/NDon't play the default sound.

 

/O The message box is created as a topmost window.

 

/Px,yThe 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 console window.

 

/PcCenter the MSGBOX window on the desktop.

 

/QDisplay a question mark icon in the message box.

 

/RThe buttons will be right-justified.

 

/SDisplay a stop sign icon in the message box.

 

/TnMSGBOX will wait a maximum of n seconds for a response (and then close). If the time limit expires, %_? will be set to 20. The time remaining before the window closes will be displayed in the default button.

 

/WDisplay an exclamation point icon in the message box.

 

/XThe message box cannot be moved.