Displays an input box to ask the user to enter a string.
InputBox, OutputVar , Title, Prompt, Hide, Width, Height, X, Y, Locale, Timeout, Default
The name of the output variable in which to store the text entered by the user.
If blank or omitted, it defaults to the name of the script (without path). Otherwise, specify the title of the input box.
If blank or omitted, it defaults to no text. Otherwise, specify the text, which is usually a message to the user indicating what kind of input is expected. If Prompt is long, it can be broken up into several shorter lines by means of a continuation section, which might improve readability and maintainability.
If blank or omitted, the user's input will be visible. Otherwise, specify the word Hide to mask the user's input, which is useful for passwords.
If blank or omitted, it defaults to about 380, depending on the OS version and theme. Otherwise, specify the width of the input box. This parameter can be an expression.
If blank or omitted, it defaults to about 200, depending on the OS version and theme. Otherwise, specify the height of the input box. This parameter can be an expression.
If blank or omitted, the input box will be centered horizontally and vertically on the screen. Otherwise, specify the X and Y coordinates of the window (use 0, 0
to move it to the upper left corner of the desktop), which can be expressions. If either coordinate is blank or omitted, the dialog will be centered in that dimension. Either coordinate can be negative to position the window partially or entirely off the desktop.
If blank or omitted, the button names are in English (OK and Cancel). Otherwise, specify the word Locale to use names according to the current user's locale (for example, Abbrechen instead of Cancel on a German OS). In addition, to display these names correctly, the buttons are made wider and the minimum width of the input box is increased. This becomes the default behavior in AutoHotkey v2.
If blank or omitted, the input box will not be automatically closed after a certain time. Otherwise, specify the timeout in seconds, which can contain a decimal point or be an expression. If this value exceeds 2147483 (24.8 days), it will be set to 2147483. After the timeout has elapsed, the input box will be automatically closed and ErrorLevel will be set to 2. OutputVar will still be set to what the user entered.
If blank or omitted, it defaults to no string. Otherwise, specify a string that will appear in the input box's edit field when the dialog first appears. The user can change it by backspacing or other means.
[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.
ErrorLevel is set to 1 if the user presses the CANCEL button, 0 if the user presses OK, or 2 if the dialog times out. In all three cases, OutputVar is set to the value entered. This allows the CANCEL button to perform a function other than CANCEL should the script designer wish it.
An input box usually looks like this:
The dialog allows the user to enter text and then press OK or CANCEL. The user can resize the dialog window by dragging its borders.
A GUI window may display a modal input box by means of Gui +OwnDialogs. A modal input box prevents the user from interacting with the GUI window until the input box is dismissed.
GUI, Input, MsgBox, FileSelectFile, FileSelectFolder, SplashTextOn, ToolTip