Creating Your First Variable
Variables Tool Window
Before We Begin
We don't want to overwrite the file from the previous tutorial. Before making any changes, we need to save a copy of the Process under a new name.
- If not already, open
- Select File on the Ribbon Command Bar. This will open the Backstage Menu with a list of commands on the left edge.
- Select Save As. The Backstage Menu will close and the Save As dialog will be displayed.
- Chose a location for your process (e.g.
C:\Users\<name>\Documents\AutoBloks) and name your process
Tutorial3. Click the Save button to save your file.
You should now have
The Variables tool window is used to browse and manage Variables. By default, this tool window is docked to the right side of the application window. You may need to use the tabs at the bottom of the dock location to switch between tool windows docked in the same location. You may also use the View tab of the Ribbon Command Bar to activate any tool window.
There are four types of variables available in AutoBloks. The primary difference between each type relates to how the data for the variable is defined.
- System Variables
- These read-only variables allow you to access data for the current system and are organized by categories (e.g. current date).
- Environment Variables
- Read-only variables defined in one or more external files commonly used to store environmental data.
- Session Variables
- When you run your automation, a session is created to host the execution. Session variables are used to access read-only data related to that session and will only be available when your automation is running (e.g. location of the results directory).
- User-Defined Variables
- These variables are defined by you for a Process or Scenario and are the only variable types where you can assign values in the tool. These are the variables you will be creating.
Take a moment to browse the Variables tool window to see the available variables. Select any variable and the details of the variable will be displayed at the bottom of the tool window.
Create New User Variable
While Google is unlikely to change their home page, the address of a website does change. In Enterprise environments, the address may shift between Development, QA, and Production environments of the same application. If you want to write a single automated process that could run against more than one of those environments, you could create a variable to store the address. When you need to switch between environments, you simply change the value of the variable. To illustrate, we will create a variable called
Url that will store the Google home page address. URL stands for "Uniform Resource Locator" and is how we define the address of pages on the internet.
- Click the New Variable button to create a new variable. This will create a new variable with the default name of
- Change the name of the variable to
- Set the default value of the variable to the Google home page
- Optionally set a description. A good variable name is typically enough to describe the purpose, but more complicated scenarios might benefit from a more detailed description.
Variable Name RulesVariable names must begin with a letter (
a-z) or underscore character (
_), and can then be following by any letter, digit (
0-9), or underscore character.
Common Naming ConventionSince spaces are not allowed in variable names, a popular naming convention is to capitalize the first letter in each word so that a change in character casing indicates a change in words. Examples are
AddressLine1. Acronyms like URL, which are typically all upper-case letters, will still only capitalize the first letter like
Creating the variable is only half of the solution. In the next step, we will cover how to use this variable in your activities. Save your Process before continuing since you added a new variable.