Nilesoft Shell Pro GitHub

INPUT


The input box allows the user to enter and pass data.


input

Show the input box with the window title and call parameter passed.
The function returns a non-zero value if the OK button is pressed. Otherwise, it returns zero.

Syntax

input("Title", "Prompt")
input("Title", "Prompt", "default text")

With a list as the fourth argument, the box shows a drop-down list to pick from instead of a text box. The fifth argument is the position of the item picked at first, counting from 0. Without it, or when it is outside the list, the item equal to the default text is picked, else the first one.

input("Title", "Pick a size", "", ['Small', 'Medium', 'Large'])
input("Title", "Pick a size", "Medium", ['Small', 'Medium', 'Large'])
input("Title", "Pick a size", "", ['Small', 'Medium', 'Large'], 2)

When the prompt is empty, the box shows "Prompt:".

input.result

Returns the input value resulting from the input box.

Syntax

input.result
input.selected

Returns the position of the item picked from the drop-down list, counting from 0. It is -1 after a box with a text box, or when the box was cancelled.

Syntax

input.selected

Example

item(title='Size' cmd=if(input('Size', 'Pick a size', '', ['Small', 'Medium', 'Large']), msg(input.result + ' is item ' + input.selected)))