$input is used to request immediate user-input.
Note: This replaces the deprecated $? identifier.
Prompts the user for input and returns the result.
- prompt - text displayed inside the input dialog window. The input dialog is extended vertically to display the prompt message if it is very long. You can also make text in the prompt message appear on different lines by using $crlf to separate lines.
- options - Options can be a combination of the following:
- e - show input editbox
- p - show input password editbox
- o - ok button
- y - yes no buttons
- n - yes no cancel buttons
- r - retry cancel buttons
- v - return $ok, $yes, $no, $cancel for buttons
- g - right-align buttons
- b - disables buttons for a second when dialog is displayed
- f - return $no/$cancel for edit/combo boxes if no/cancel is pressed
- iqwh - show the info, question, warning, and halt icons respectively.
- d - play system sound associated with icon.
- s - indicates that window name has been specified
- a - activate dialog
- u - use current active window as parent window
- kN - an N second timeout value. On timing out, $timeout is returned if v is specified, no value if e is specified, and $false otherwise.
- m - indicates that multiple text parameters have been specified. They will be displayed in a combobox. The first text item is the default item (a reference to an item in the list), the rest are the items in the list.
- window - if option s is specified, the name of the window to be used as parent window.
- title - the titlebar text.
- text - default text placed in the input editbox
The options, window, title, and text are optional parameters.
By default, buttons return $true or $null, same as $?. If there is an input editbox, the ok/yes buttons always return the contents of the editbox (unless f switch is used).
For the options parameter, you can also use a number as a combination of value added together, which is how $input was originally working:
- 1 - show input editbox (equivalent of the 'e' switch)
- 2 - show input password editbox (equivalent of 'p' switch)
- 4 - ok button (equivalent of 'o')
- 8 - yes/no buttons ('y')
- 16 - yesnocancel buttons ('n')
- 32 - return $ok, $yes, $no, $cancel for buttons. ('v')
- 64 - show the info icon ('i')
- 128 - show the question icon ('q')
- 256 - show the warning icon ('w')
- 512 - show the hand icon ('h')
$input(sup,5) is equivalent to $input(sup,eo)
Note: This identifier cannot be used in a remote event. One way around this is to use a /timer to initiate an input request after the script ends. Another way around it is to use /signal to trigger an on signal event.
Echoes whatever the user types into the input field to the active window.
Does the same as the first example, except while the user is typing, the characters are replaced by password characters. The typed value, however, is visibly legible when it is echoed to the active window.