Rob van der Woude's Scripting Pages

Help text for MessageBox.cs

(view help text of MessageBox.cs as plain text)

MessageBox.exe,  Version 1.34
Batch tool to show a message in a MessageBox and return
the caption of the button that is clicked

Usage:  MessageBox "message" [ "title" ]  [ switches ]

   or:  MessageBox "message" "title" buttons icon default [option] timeout

Where:
        buttons "AbortRetryIgnore", "OK", "OKCancel",
                "RetryCancel", "YesNo" or "YesNoCancel"
        icon    "Asterisk", "Error", "Exclamation", "Hand",
                "Information", "None", "Question", "Stop"
                or "Warning"
        default "Button1", "Button2" or "Button3" or the
                default button's (English) caption
        option  "HideConsole", "NoEscape", "RightAlign",
                "RtlReading", "None" or ""
        timeout timeout interval in seconds

Switches:
                /B:buttons      A = AbortRetryIgnore, O = OK,
                                C = OKCancel, R = RetryCancel,
                                Y = YesNo, N = YesNoCancel
                /I:icon         A = Asterisk, E = Error,
                                X = Exclamation, H = Hand,
                                I = Information, N = None,
                                Q = Question, S = Stop
                                W = Warning
                /D:default      1 = Button1, 2 = Button2,
                                3 = Button3 or use the default
                                button's (English) caption
                /O:option       H = HideConsole, N = NoEscape,
                                R = RightAlign, L = RtlReading
                /R              Return code tells which button
                                was clicked (see Notes)
                /T:timeout      timeout interval in seconds

Notes:

Use switches if you want to skip arguments.

Always specify buttons BEFORE specifying default.

Using the "HideConsole" option will hide the console window permanently, thereby disabling all console based user
interaction (e.g. "ECHO" and "PAUSE").
It is intended to be used in scripts that run "hidden" themselves, e.g. VBScript with the WScript.exe interpreter.
Do not use this option in a batch file unless hiding the console window permanently is intended.

Linefeeds (\n or \012 and/or \r or \015), tabs (\t or \007), singlequotes (' or \047) and doublequotes (\" or \042) are
allowed in the message string.
Unicode characters (e.g. "\u5173" for "?") are allowed in the message string and in the title.
By default, however, these linefeeds, tabs, quotes and Unicode characters will be escaped to allow correct display of
paths.
Use option "NoEscape" to disable all character escaping except doublequotes.

The (English) caption of the button that was clicked is returned as text to Standard Output (in lower case), or
"timeout" if the timeout interval expired.

When using the timeout feature, A window with the current MessageBox's TITLE will be closed, not necessarily THE
current MessageBox.
To prevent closing the wrong MessageBox, use unique titles.

The timeout feature should not be combined with buttons Abort Retry Fail; if it is, the MessageBox will remain open
even after the timeout expires, until a button is clicked, and then return the "timeout" result.

Unless the /R switch is used, the return code of the program is 0 if a button was clicked, 1 in case of (command line)
errors, 2 if cancelled (this does require a Cancel button), 3 if the timeout expired.
When the /R switch is used, the return code of the program is 1 if button 1 was clicked, 2 if button 2 was clicked, 3
if button 3 was clicked, 4 if the timeout expired, -1 in case of (command line) errors, or 0 if the MessageBox is
cancelled without a Cancel button being available.

Credits:

Code to hide console by Anthony on:
http://stackoverflow.com/a/15079092

MessageBox timeout based on code by DmitryG on:
http://stackoverflow.com/a/14522952

Written by Rob van der Woude
https://www.robvanderwoude.com

page last uploaded: 2022-10-05; loaded in 0.0053 seconds