Create variables via prompt
- Updated: 2024/10/23
Create variables via prompt
Using Co-Pilot for Automators, developers can specify the value and map a variable with a natural language prompt.
Co-Pilot for Automators assists development with creating variables in two ways. First, developers can send a single prompt with instructions for the properties of one or multiple variables to create them to specifications. Second, a variable is created and mapped automatically to any action that requires a variable, unless an existing variable is referenced in the prompt. A default naming convention is used for any variables created automatically.
Instructions for a prompt to create variables
- Create a new variable.
- Properties like the name, type of variable, and how the variable should
be used (input, output, constant) are recognized in your prompt.
Existing variables can then be referenced by another prompt and mapped
to an existing action. Example shows prompts entered one at a time.
Create an input string variable named Var1 and assign it the value "Hello, world!"
Set the message box to display Var1.
Tip: Alternatively, the first prompt can be entered shorter:Create an input string variable ‘Var1’ = "Hello, world!"
- Add an action with a new variable mapped.
- When adding a new action to your automation, you can easily create and
simultaneously map a new variable to the new action with a single
prompt.
Example:
Add a message box and assign it a new input string variable named Var1 with the value "Hello, world!"
- Create multiple variables in a single prompt.
- When creating multiple variables with a single prompt, use a comma or
full stop punctuation to separate instructions for each variable.
Examples show two prompts resulting in the same output.
Create an input string variable named Var1, an output string variable named Var2, and an input and output variable named Var3. Assign Var1 the value "open", Var2 the value "closed", and Var3 the value "pending".
Create an input string variable 'Var1' = "open", an output string variable 'Var2' = "closed", and an input and output variable 'Var3' = "pending".
- Create variables with unique properties.
- Support is provided for variables such as Table, and Session type that
might have unique properties. Ensure you include the complete set of
properties for these variable types in the prompt. For table type
variables the dimensions and a default cell value can be specified in
the instruction.Examples:
Create a terminal session variable named pSessTerminal.
Create a 3x4 table variable with default value 0, named pTableVar1.
Automatically create variables
Co-Pilot for Automators helps developers focus on automation results and the operations of actions by helping with some of the tedious work of variable creation. If a variable does not exist and one is needed for the action described by a prompt, a variable is automatically created and mapped to the action requiring it. When variables are created this way a standard naming convention is applied, determined by the type of variable (pBool, pDict, pStr). When ready, the developer can then manually edit any variables to set the value and any other properties.
Example: Add a Prompt to the path of the folder
.
Credential variables
- Locker name
- Credential name
- Attribute: username, password, Client ID, etc.
Learn more about credential variables in the following topic. See, Credentials and credential variables in the Bot editor.
- Further details on the properties and behaviors of variables are available. See, Variables overview
- Variables dependent on Control Room files are supported, such as bot, form, process, and API Tasks. See, Add existing repository file via prompt.