Difference between revisions of "$input"

From Scriptwiki
Jump to: navigation, search
m (Added beta -b switch)
m (Infinite timer is not a pretty good example.)
Line 5: Line 5:
 
* 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.
 
* 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.
 
* 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.
+
** e - Show 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.
 +
** o - Show an "OK" button.
 +
** y - Show a "Yes" and "No" button.
 +
*** When used with e, returns the text or [[$null]] respectively.
 +
*** When used without e, returns [[$true]] or [[$false]] respectively.
 +
** n - Show 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.
 +
** r - Show a "Retry" and "Cancel" button.
 +
*** When used with e, returns the text or [[$null]] respectively.
 +
*** When used without e, returns [[$true]] or [[$false]] respectively.
 +
** v - Return "$ok" "$yes" "$no" "$retry" or "$cancel" instead of [[$true]] or [[$false]]. Cancel and no still return [[$null]] when used with e.
 +
** g - Aligns buttons to the right instead of centering them.
 +
** iqwh - Shows the info, question, warning, and hand icons respectively.
 +
** d - Plays system sound associated with the specified icons.
 +
** s - Indicates that a window has been specified.
 +
** a - Actives the input dialog automatically.
 +
** u - Uses the current window as the parent. Do not use with "s" or if a window has been indicated.
 +
** kN - Gives the user N seconds to respond. If they do not, either [[$null]] is returned (used with e), $timeout is returned (used with v), or $false is returned.
 
* Title is the title you wish to give the input dialog box.
 
* Title is the title you wish to give the input dialog box.
 
* Text is the default text to be entered when used with "e"
 
* Text is the default text to be entered when used with "e"
The options, window, title, and text are optional parameters.
 
  
==Options==
+
== Note ==
<table border=1 rules=all cellpadding=4><tr><td>e</td><td>Show 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.</td></tr>
 
<tr><td>p</td><td>Show input password editbox. (Replaces text in editbox with stars)</td></tr>
 
<tr><td>o</td><td>Show an "OK" button.</td></tr>
 
<tr><td>y</td><td>Show a "Yes" and "No" button.<br>
 
* When used with e, returns the text or [[$null]] respectively.
 
* When used without e, returns [[$true]] or [[$false]] respectively.</td></tr>
 
<tr><td>n</td><td>Show a "Yes" "No" and "Cancel" button.<br>
 
* When used with e, returns the text, [[$null]] or [[$null]] respectively.<br>
 
* When used without e, returns [[$true]] [[$false]] and [[$null]] respectively.</td></tr>
 
<tr><td>r</td><td>Show a "Retry" and "Cancel" button.<br>
 
* When used with e, returns the text or [[$null]] respectively.<br>
 
* When used without e, returns [[$true]] or [[$false]] respectively.</td></tr>
 
<tr><td>v</td><td>Return "$ok" "$yes" "$no" "$retry" or "$cancel" instead of [[$true]] or [[$false]]. Does not work when used with e.</td></tr>
 
<tr><td>g</td><td>Aligns buttons to the right instead of centering them.</td></tr>
 
<tr><td>b</td><td>Disables buttons for a second when dialog is displayed. {{beta}}</td></tr>
 
<tr><td>iqwhct</td><td>Shows the info, question, warning, hand, delete and star icons respectively.</td></tr>
 
<tr><td>d</td><td>Plays system sound associated with the specified icons.</td></tr>
 
<tr><td>s</td><td>Indicates that a window has been specified.</td></tr>
 
<tr><td>a</td><td>Actives the input dialog automatically.</td></tr>
 
<tr><td>u</td><td>Uses the current window as the parent. Do not use with "s" or if a window has been indicated.</td></tr>
 
<tr><td>kN</td><td>Gives 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.</td></tr>
 
<tr><td>m</td><td>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.</td></tr>
 
</table>
 
 
 
==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. <br />
 
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. <br />
 
Example:  
 
Example:  
  on *:text:Foo:#:{ /timer 0 0 echo -a $?="Bar?" }
+
  on *:text:Foo:#:{ /timer 1 0 echo -a $?="Bar?" }
 
 
==See Also==
 
 
 
* [[$?]]
 
  
 
[[Category:Remote Identifiers]]
 
[[Category:Remote Identifiers]]

Revision as of 15:43, 22 June 2013

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.
    • e - Show 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.
    • o - Show an "OK" button.
    • y - Show a "Yes" and "No" button.
      • When used with e, returns the text or $null respectively.
      • When used without e, returns $true or $false respectively.
    • n - Show 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.
    • r - Show a "Retry" and "Cancel" button.
      • When used with e, returns the text or $null respectively.
      • When used without e, returns $true or $false respectively.
    • v - Return "$ok" "$yes" "$no" "$retry" or "$cancel" instead of $true or $false. Cancel and no still return $null when used with e.
    • g - Aligns buttons to the right instead of centering them.
    • iqwh - Shows the info, question, warning, and hand icons respectively.
    • d - Plays system sound associated with the specified icons.
    • s - Indicates that a window has been specified.
    • a - Actives the input dialog automatically.
    • u - Uses the current window as the parent. Do not use with "s" or if a window has been indicated.
    • kN - Gives the user N seconds to respond. If they do not, either $null is returned (used with e), $timeout is returned (used with v), or $false is returned.
  • Title is the title you wish to give the input dialog box.
  • Text is the default text to be entered when used with "e"

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?" }