$input

From Scriptwiki
Jump to: navigation, search

Input is a multi-purpose identifier for requesting input from a user in an auto-rendered pop up dialog, similar to $?.

$input(prompt [,options] [,window] [,title] [,text])
  • Prompt is the text you wish to display to the user. This is usually to tell the user what you wish to be inputted. You may use a $crlf to force a line break.
  • Options is a list of option flags. Defaults to an "OK" and "Cancel" button which return $true or $false respetively.
  • Window is the name of the window to be used as parent window.
  • Title is the title you wish to give the input dialog box.
  • Text is the default text to be entered when used with "e"

The options, window, title, and text are optional parameters.

Options

eShow an editbox for input. "OK" and "Cancel" are default buttons. $null is returned if "Cancel" is pressed, and the text is returned if "OK" is pressed.
pShow input password editbox. (Replaces text in editbox with stars)
oShow an "OK" button.
yShow a "Yes" and "No" button.
  • When used with e, returns the text or $null respectively.
  • When used without e, returns $true or $false respectively.
nShow a "Yes" "No" and "Cancel" button.
  • When used with e, returns the text, $null or $null respectively.
  • When used without e, returns $true $false and $null respectively.
rShow a "Retry" and "Cancel" button.
  • When used with e, returns the text or $null respectively.
  • When used without e, returns $true or $false respectively.
vReturn "$ok" "$yes" "$no" "$retry" or "$cancel" instead of $true or $false. Does not work when used with e.
gAligns buttons to the right instead of centering them.
bDisables buttons for a second when dialog is displayed.
iqwhctShows the info, question, warning, hand, delete and star icons respectively.
dPlays system sound associated with the specified icons.
sIndicates that a window has been specified.
aActives the input dialog automatically.
uUses the current window as the parent. Do not use with "s" or if a window has been indicated.
kNGives the user N seconds to respond. If they do not, either $null is returned (when used with e), $timeout is returned (used with v), or $false is returned.
mIndicates 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.

Note

This identifier cannot be used in a script event. One way around this is to use /scon or a /timer to initiate an input request after the script ends.
Example:

on *:text:Foo:#:{ /timer 1 0 echo -a $?="Bar?" }

See Also