Displays an input box to ask the user to enter a string.
InputBox ( "title", "prompt" [, "default" [, "password char" [, width = -1 [, height = -1 [, left = Default [, top = Default [, timeout = 0 [, hwnd]]]]]]]] )
The InputBox() is user-resizable, but has a minimum size of approximately 190 x 115 pixels. Default size is approximately 250 x 190 pixels.
The string returned will not exceed 254 characters and if input contains carriage returns or linefeeds, the result will be truncated at the first occurrence of those characters.
The second and subsequent characters of the password field can be used to restrict input. Use a space to fill the first character to still see the characters typed. Putting an M after the first character indicates that input is Mandatory; i.e. you must enter something. Nothing will happen if you press the Ok button when there is nothing in the InputBox(). It will not close and return the string.
If your script is going to use an inputbox you must include the pragma directive "#pragma compile(inputboxres, true)"
You can also specify the maximum length at the end of the password field. Just enter a number as the last character(s) to specify the length of the string.
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Places the input box in the top left corner displaying the characters as they
; are typed.
Local $sAnswer= InputBox ("Question","Where were you born?","Planet Earth","",_
- 1,- 1,0,0)
; Display the result.
MsgBox ($MB_SYSTEMMODAL,"",$sAnswer)
; Asks the user to enter a password. Don't forget to validate it!
Local $sPasswd= InputBox ("Security Check","Enter your password.","","*")
; Display the result.
MsgBox ($MB_SYSTEMMODAL,"",$sPasswd)
; Asks the user to enter a 1 or 2 character response. The M in the password
; field indicates that empty string is not accepted and the 2 indicates that the
; responce will be at most 2 characters long.
Local $sValue= InputBox ("Testing","Enter the 1 or 2 character code.",""," M2")
; Display the result.
MsgBox ($MB_SYSTEMMODAL,"",$sValue)
EndFunc ;==>Example