Dialog - Input
Declaration
<AMSHOWDIALOG ACTIVITY="input" MESSAGE="text" DEFAULTVALUE="text" RESULTVARIABLE="text" WINDOWTITLE="text" MAXLENGTH="number" POSITION="text (options)" XPOS="number" YPOS="number" ICON="text (options)" DEFAULTBUTTON="number (options)" ONCANCEL="text (options)" ONCANCELTASK="text" ONCANCELVARNAME="text" ONCANCELVARVALUE="text" COUNTDOWNDELAY="text" MEASURE="text (options)" MASKINPUT="YES/NO" />
Description
Displays an input dialog allowing the user to enter a specific text value during runtime. The value is saved to the variable specified. Execution is paused while the task waits for a value to be entered. A default value can be specified in case no value is entered.
Practical usage
Useful for asking a question that requires a text response at runtime. Can be used to make decisions during task execution. For example, if value 1 is entered, continue to the next step; if value 2 is entered, end the task.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Message to display | Text | Yes | (Empty) | MESSAGETEXT="What's your answer to the question?" | The text message to be displayed in the input box during runtime. This is usually a question that the user should input an answer to. |
Default value | Text | No | (Empty) | DEFAULTVALUE="theValue" | The default text value that should appear in the input box. Setting a default value (when possible) allows task execution to continue in case no user interaction occurs. This parameter is optional. |
Maximum length of string | Number | No | Disabled | MAXLENGTH="30" | If enabled, specifies the maximum characters the user can enter in the input box. This prevents users from entering invalid data (such as entering more than 5 digits in a zip code field). |
Populate variable with value entered | Text | No | (Empty) | RESULTVARIABLE="varname" | The name of an existing variable to be populated with the text that the user entered as a response to the message. |
Mask input | Yes/No | No | No | MASKINPUT="YES" | If selected, allows the text being entered in the input box to be masked in real-time (for example, ######). This is useful if the user is entering a password or other sensitive data. This parameter is disabled by default. |
Title of message box | Text | No | (Empty) | WINDOWTITLE="QUESTION" | The title that should appear in the title bar of the input box. |
Bring dialog to front | Yes/No | No | Yes | WINDOWINFRONT="NO" | If selected, specifies that the input box will appear in front of all other open windows. This parameter is selected by default. |
Buttons
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Button selected by default | Number | No | 0 |
|
The number associated with the button that should be automatically selected if no user interaction is applied within the time limit specified in the Automatically select the default button after parameter (below). The OK button correlates with "0" and the Cancel button correlates with "1". Setting a default button allows task execution to continue in case no user interaction occurs. The default value is "0". |
On cancel | Text (Options) | No | Stop |
|
Specifies
how this activity should react if the Cancel
button is selected . The available options are:
|
Task to start | Text | Yes, if On cancel is set to Start a task | (Empty) | ONCANCELTASK="task_name" | The path and file name of the Automate Desktop task (.aml) file to start if the Cancel button is selected. Click the folder icon to navigate to the desired task file or enter the path and file name manually in the provided text box. This parameter is available only if the On cancel parameter is set to Start a task. |
Variable name | Text | Yes, if On cancel is set to Set variable | (Empty) | ONCANCELVARNAME="var1" | The name of the variable whose value to set. This parameter is available only of the On cancel parameter is set to Set a variable. |
Variable value | Text | Yes, if On cancel is set to Set variable | (Empty) | ONCANCELVARVALUE="value" | The value to set the variable to. This parameter is available only of the On cancel parameter is set to Set a variable. |
Automatically select the default button after | Number | No | Disabled | COUNTDOWNDELAY="10" | If enabled, specifies the amount (numeric value) of time that should elapse before the default button is selected as specified in the Button selected by default parameter. If this parameter is disabled, the input box is displayed indefinitely. This parameter is disabled by default. |
Measure | Text (Options) | No | Seconds |
|
Denotes
the time measurement to associate with the value entered in the
Automatically select the default
button after parameter. The available options are:
|
Populate variable with value entered | Text | No | (Empty) | RESULTVARIABLE="varname" | The name of an existing variable to be populated with the text that the user entered as a response to the message. |
Mask input | Yes/No | No | No | MASKINPUT="YES" | If selected, allows the text being entered in the input box to be masked in real-time. This is useful when the user is entering a password or other sensitive data. |
Title of message box | Text | No | (Empty) | WINDOWTITLE="QUESTION" | The title that should appear in the title bar of the input box. |
Bring dialog to front | Yes/No | No | Yes | WINDOWINFRONT="NO" | If selected, specifies that the input box will appear in front of all other open windows. This parameter is selected by default. |
Advanced
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Position | Text (Options) | No | Center of screen |
|
The
screen position in which to display the input dialog. The available
options are:
|
Window coordinates (X) | Number | Yes, if Position is set to Custom location | (Empty) | XPOS="55" | The X (horizontal) coordinates of the position that the upper left corner of the input dialog should be displayed on the screen. To capture X coordinates using your mouse, enable the Capture mouse position (press Space to capture) option, move the mouse cursor to the desired location on the screen and press Space on your keyboard to capture the position. This parameter is available only if the Position parameter is set to Custom location. |
Window coordinates (Y) | Number | Yes, if Position is set to Custom location | (Empty) | YPOS="55" | The Y (vertical) coordinates of the position that the upper left corner of the input box should be displayed on the screen. To capture Y coordinates using your mouse, enable the Capture mouse position (press Space to capture) option, move the mouse cursor to the desired location on the screen and press Space on your keyboard to capture the position. This parameter is available only if the Position parameter is set to Custom location. |
Dialog title icon | Text(Options) | No | (Empty) |
|
Specifies
the icon that should be displayed next to the title. This helps
to determine what type of message is being displayed. The available
options are:
|
Examples
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Example 1
This sample task saves the text entered in an input box to a variable and then displays it in a message box.
<AMVARIABLE NAME="textEntered"></AMVARIABLE>
<AMSHOWDIALOG ACTIVITY="input" RESULTVARIABLE="textEntered" WINDOWTITLE="ENTER TEXT">Please enter some text here.</AMSHOWDIALOG>
<AMSHOWDIALOG WINDOWTITLE="TEXT ENTERED">The text that was entered: %textEntered%</AMSHOWDIALOG>
Example 2
This sample task demonstrates use of the Input Dialog and Message Dialog, and demonstrates use of variables, BASIC Script, IF/End if activities and expressions.
<AMVARIABLE NAME="theanswer" DESCRIPTION="" VALUE="" />
<AMSCRIPT>Function SquareNumber(thenum)SquareNumber = thenum * thenumEnd Function</AMSCRIPT>
<AMSHOWDIALOG ACTIVITY="input" RESULTVARIABLE="theanswer" MESSAGE="What number would you like to square?"></AMSHOWDIALOG>
<AMIF EXPRESSION="IsNumeric(theanswer) = true"><AMSHOWDIALOG>The number %theanswer% squared is %SquareNumber(theanswer)%</AMSHOWDIALOG><AMELSE />
<AMSHOWDIALOG>The text "%theanswer%" is not a valid number. Please re-run and enter a valid number.</AMSHOWDIALOG></AMIF>
<AMSHOWDIALOG>The number %theanswer% squared is %SquareNumber(theanswer)%</AMSHOWDIALOG><AMELSE />
<AMSHOWDIALOG>The text "%theanswer%" is not a valid number. Please re-run and enter a valid number.</AMSHOWDIALOG>
<AMIF ACTIVITY="end" />