The renewal maintenance has officially ended for Progress iMacros effective November 30, 2023.
This Wiki site will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely, The Progress Team
Difference between revisions of "PROMPT"
(6 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
Displays a popup to ask for a value. This value is stored in variable_name. This command can be used to change the variables !VAR1, !VAR2 or !VAR3, but not built-in variables like !DATASOURCE or dynamically generated variables. | Displays a popup to ask for a value. This value is stored in variable_name. This command can be used to change the variables !VAR1, !VAR2 or !VAR3, but not built-in variables like !DATASOURCE or dynamically generated variables. | ||
− | === Syntax [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]] [[Image:Ff-icon.png|Firefox]]=== | + | === Syntax [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]] [[Image:Ff-icon.png|Firefox]] [[Image:Cr-icon.png|Chrome]]=== |
PROMPT prompt_text variable_name [default_value] | PROMPT prompt_text variable_name [default_value] | ||
Line 8: | Line 8: | ||
*prompt_text | *prompt_text | ||
− | *:The text which is to be displayed above the input text field. | + | *:The text which is to be displayed above the input text field. If the text includes embedded spaces, surround the text with double-quotes *or* replace spaces with <SP>. |
*variable_name | *variable_name | ||
*:Name of the variable to save the user input in (!VAR1, !VAR2 or !VAR3) | *:Name of the variable to save the user input in (!VAR1, !VAR2 or !VAR3) | ||
*default_value | *default_value | ||
*:Default value which will be displayed in the input field when the dialog comes up. Must not be a value of a built-in variable except !VAR1, !VAR2 or !VAR3. | *:Default value which will be displayed in the input field when the dialog comes up. Must not be a value of a built-in variable except !VAR1, !VAR2 or !VAR3. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Examples === | === Examples === | ||
Line 23: | Line 18: | ||
If you do not want to save passwords (even encrypted) on your computer then use the following code to ask for the password: | If you do not want to save passwords (even encrypted) on your computer then use the following code to ask for the password: | ||
− | PROMPT Please | + | PROMPT "Please enter your password:" !VAR1 |
However this requires the following SET and TAG commands to make use of the PROMPT input of a password | However this requires the following SET and TAG commands to make use of the PROMPT input of a password | ||
SET !ENCRYPTION NO | SET !ENCRYPTION NO | ||
− | PROMPT Please | + | PROMPT "Please enter your password:" !VAR1 |
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:loginbox ATTR=ID:pass CONTENT=<nowiki>{{!VAR1}}</nowiki> | TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:loginbox ATTR=ID:pass CONTENT=<nowiki>{{!VAR1}}</nowiki> | ||
Line 43: | Line 38: | ||
=== See Also === | === See Also === | ||
− | [[SET]], [[CMDLINE]], [[PAUSE]], [[!SINGLESTEP]] | + | [[DISPLAY]], [[SET]], [[CMDLINE]], [[PAUSE]], [[!SINGLESTEP]] |
Revision as of 08:11, 11 August 2017
Displays a popup to ask for a value. This value is stored in variable_name. This command can be used to change the variables !VAR1, !VAR2 or !VAR3, but not built-in variables like !DATASOURCE or dynamically generated variables.
Syntax
PROMPT prompt_text variable_name [default_value]
Parameters
- prompt_text
- The text which is to be displayed above the input text field. If the text includes embedded spaces, surround the text with double-quotes *or* replace spaces with <SP>.
- variable_name
- Name of the variable to save the user input in (!VAR1, !VAR2 or !VAR3)
- default_value
- Default value which will be displayed in the input field when the dialog comes up. Must not be a value of a built-in variable except !VAR1, !VAR2 or !VAR3.
Examples
If you do not want to save passwords (even encrypted) on your computer then use the following code to ask for the password:
PROMPT "Please enter your password:" !VAR1
However this requires the following SET and TAG commands to make use of the PROMPT input of a password
SET !ENCRYPTION NO PROMPT "Please enter your password:" !VAR1 TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:loginbox ATTR=ID:pass CONTENT={{!VAR1}}
Note: the Set !ENCRYPTION is required in the script to turn off password encryption and the TAG command is required to enter the value into the password field, note the use of "{{}}" (double closed braces) on the variable name. For this sample to work on your site the POS, FORM and ATTR values may be different, just use the macro record feature to capture these values from your site and paste them into your macro.
Suppose you would like to ask for more then three inputs from the user. Since you only have three variables to use the PROMPT command for you might run into problems. The solution is to navigate to the site where you are going to fill the values in, then ask for the first three inputs, fill them into the website, ask for the next three values, fill them in etc.
The PROMPT command is also useful for debugging: Use it to show the values of variables. The dialog resizes with the length of the prompt_text input, so you can also use it show longer text.
PROMPT {{!EXTRACT}} PROMPT {{!myvar}}
or
PROMPT Extracted<SP>data:{{!EXTRACT}} !VAR1 myvar:{{!myvar}}