Rob van der Woude's Scripting Pages

Help text for InputBox.cs

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

InputBox,  Version 1.38
Prompt for input (GUI)

Usage:   INPUTBOX  [ "prompt"  [ "title"  [ "default" ] ] ] [ options ]

Where:   "prompt"    is the text above the input field (use \n for new line)
         "title"     is the caption in the title bar
         "default"   is the default answer shown in the input field

Options: /A          accepts ASCII characters only (requires /M)
         /B          use standard Black and white in console, no highlighting
         /F:regex    use regex to filter input on-the-Fly (see Notes)
         /H:height   sets the Height of the input box
                     (default: 110; minimum: 110; maximum: screen height)
         /I          regular expressions are case Insensitive
                     (default: regular expressions are case sensitive)
         /L[:string] use Localized or custom captions (see Notes)
         /M:mask     accept input only if it matches mask
         /N          Not filtered, only doublequotes are removed from input
                     (default: remove & < > | ")
         /O          dialog window remains always On top
         /P          hides (masks) the input text (for Passwords)
         /R:regex    accept input only if it matches Regular expression regex
         /S[:text]   inserts a checkbox "Show password" (or specified text)
         /T[:sec]    sets the optional Timeout in seconds (default: 60)
         /U          return Unmasked input, without literals (requires /M)
                     (default: include literals in result)
         /W:width    sets the Width of the input box
                     (default: 200; minimum: 200; maximum: screen width)

Example: prompt for password
InputBox.exe "Enter your password:" "Login" /S

Example: fixed length hexadecimal input (enter as a single command line)
InputBox.exe "Enter a MAC address:" "MAC Address" "0022446688AACCEE"
             /M:">CC\:CC\:CC\:CC\:CC\:CC\:CC\:CC" /R:"[\dA-F]{16}"
             /F:"[\dA-F]{0,16}" /U /I

Notes:   For hidden input (/P and/or /S), ), "default" will be ignored.
         With /F, regex must test the unmasked input (without literals), e.g.
         /M:"CC:CC:CC:CC:CC:CC:CC:CC" /F:"[\dA-F]{0,16}" /I for MAC address.
         With /R, regex is used to test input after OK is clicked;
         with /F, regex is used to test input each time the input
         changes, so regex must be able to cope with partial input;
         e.g. /F:"[\dA-F]{0,16}" is OK, but /F:"[\dA-F]{16}" will fail.
         Be careful with /N, use doublequotes for the "captured" result,
         or redirect the result to a (temporary) file.
         Show password (/S) implies hiding the input text (/P).
         Use /M (without mask) to show detailed help on the mask language.
         Use /L for Localized "OK" and "Cancel" button captions.
         Custom captions require a string like /L:"OK=caption;Cancel=caption"
         (button=caption pairs separated by semicolons, each button optional)
         Text from input is written to Standard Output only if "OK" is clicked.
         Return code is 0 for "OK", 1 for (command line) errors, 2 for
         "Cancel", 3 on timeout, 4 if no regex or mask match.

Credits: On-the-fly form based on code by Gorkem Gencay on StackOverflow:
         Code to retrieve localized button captions by Martin Stoeckli:

Written by Rob van der Woude

page last uploaded: 2022-10-05