Input Field

Other topics

Remarks:

An input box is a GUI item, so it will be treated as a GUI item.

A list of errorlevels for this command:

ErrorlevelWhat it Means
0The user pressed the 'OK' button
1The user pressed the 'Cancel' button
2The input box timed out

You can find the page for this command on the AutoHotkey documentation here: https://autohotkey.com/docs/commands/InputBox.htm

Basic Usage Example

InputBox, userinput

This will store what the user types into the input box in the variable named userinput

Passwords

InputBox, password, Enter your Password,, HIDE,, 100

Loop, {
  if (errorlevel = 1)
return

  if (password = "password") {
MsgBox, The password is correct.
    return
  } else if (password != "password") {
MsgBox, The password is incorrect.
InputBox, password, Enter your Password,, HIDE,, 100
  }
}

This will check if the user has typed "password" in the input box. If the user types the correct value, it will say "The password is correct." and close the input box. If the user types the incorrect value, it will say "The password is incorrect." and reopen the input box. If the errorlevel is 1 (the user pressed cancel), it will terminate the script.

Parameters:

InputBox, OutputVar [, Title, Prompt, HIDE, Width, Height, X, Y, Timeout, Default]What each Option Means
OutputVarThe variable the user's input will be saved to
TitleThe name of the input box
PromptText inside of the input box
HIDEDisplays the user's input as asterisks to hide the input - type HIDE to enable
WidthThe width of the input box
HeightThe height of the input box
XThe amount of pixels from the left edge of the screen that the top-left corner of the input box will be
YThe amount of pixels from the top edge of the screen that the top-left corner of the input box will be
TimeoutAutomatically closes the input box and saves the user's input after this time in miliseconds
DefaultThe text that will appear in the input box's editable field when it is opened

Contributors

Topic Id: 9917

Example Ids: 30506,30507

This site is not affiliated with any of the contributors.