Displays an input box to ask the user to enter a string.
InputBox ( "title", "Prompt" [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )
Parameters
title | The title of the input box. |
prompt | A message to the user indicating what kind of input is expected. |
default | The value that the input box starts with. |
password char | [optional] The character to replace all typed characters with. If you want the actual typed character to appear, define with an empty string ("") (default) or a space for the first character. If you provide a multiple-char string, only the first char is used for character masking. There are special meanings for the second and subsequent characters. See Remarks. |
width | [optional] The width of the window. If defined, height must also be defined. Use -1 for default width. |
height | [optional] The height of the window. If defined, width must also be defined. Use -1 for default height. |
left | [optional] The left side of the input box. By default, the box is centered. If defined, top must also be defined. |
top | [optional] The top of the input box. By default, the box is centered. If defined, left must also be defined. |
timeout | [optional] How many seconds to wait before automatically cancelling the InputBox. |
Return Value
Success: | Returns the string that was entered. |
Failure: | Returns an empty string and sets @error as follows: |
@Error | 0 = The string returned is valid. |
1 = The Cancel button was pushed. | |
2 = The Timeout time was reached. | |
3 = The InputBox failed to open. This is usually caused by bad arguments. |
Remarks
BlockInput(1) prevents Windows 98/Me users from inputting data.
Related
MsgBox
Example
;Places the input box in the top left corner displaying the characters as they
;are typed.
$answer = InputBox("Question", "Where were you born?", "Planet Earth", "", _
-1, -1, 0, 0)
;Asks the user to enter a password. Don't forget to validate it!
$passwd = InputBox("Security Check", "Enter your password.", "", "*")
;Asks the user to enter a 1 or 2 character response. The M in the password
;field indicates that blank string are not accepted and the 2 indicates that the
;responce will be at most 2 characters long.
$value = InputBox("Testing", "Enter the 1 or 2 character code.", "", " M2")