Function description
InputBox
Displays an input box for the user to enter data. InputBox ("title", "Hint info" [, "Default data" [, "Password Characters" [, width, height [, left, top [, timeout]]]
Parameters
| Title |
The caption text for the input box. |
| Hint Information |
Prompts the user for the data that the program needs to obtain. |
| Default data |
The default text that appears in the Input text box. |
| Password characters |
Optional parameters display characters that are used in place of the user input characters in the input text box. If you want to display the characters normally, you only need to define this parameter to be an empty string "" (default) or a space character. If this parameter is set to a string with multiple characters, only the first word character character valid. The second and subsequent characters have other special uses. Please check out the following note section below. |
| Width |
Optional Parameters window width. The height parameter must also be specified if this parameter is specified. Specifying-1 indicates that the default width is used. |
| Height |
Optional Parameters window height. The width parameter must also be specified if this parameter is specified. Specifying-1 indicates that the default height is used. |
| Left |
[Optional parameters] the distance (in pixels) to the left of the screen from the left-hand side of the box. By default, the input box is centered, and the top argument must be specified if you specify this parameter. |
| Top |
[Optional parameters] the distance (pixel) from the top of the box to the left of the screen. By default, the input box is centered, and the left parameter must be specified if you specify this parameter. |
| Timeout time |
[Optional parameters] in seconds. The input box closes automatically after the specified time. |
return value
| Success: |
Returns the string entered by the user. |
| Failed: |
Returns an empty string and sets the @error to one of the following values: |
| @Error |
0 = The returned string is valid. |
|
1 = The user presses the Cancel button. |
|
2 = timeout. |
|
3 = The input box displays a failure, which is usually caused by an invalid parameter. |
Attention
Use Blockinput (1) To prevent users from entering data (Windows 98/me).
The user can adjust the window size of the input box with a minimum size limit: approximately 190 x 115 (pixels). The default size is approximately 190 x (pixels).
The returned string will not exceed 254 characters, and if the input contains a carriage return or line feed, the returned string is broken by the first of those characters.
The second and subsequent character characters of the password character parameter are used to restrict user input. If the first character is a space, the entered character will be visible if the second character is
MIndicates that the input will be mandatory (
MAndatory), which means that the user must enter at least one character, and if no content is entered, press
Okbutton, the script will not react, and the input box will neither disappear nor return a string.
Alternatively, you can add a number to the password character parameter to specify the maximum length of the input string (refer to the following example).
Related
MsgBox
Example
The following input box will appear in the upper-left corner of the screen and display the corresponding prompt text.
$answer = InputBox(Problem, "Where is your birthplace, please?" ", Earth, "", _
-1, -1, 0, 0)
, requiring the user to enter a password. In the actual program code do not forget to provide a confirmation password Oh!
$passwd = inputbox, ,,
$value = inputbox "test" , "Please enter the character 1 or 2:" ,,