In this tutorial we will learn how to use variables in workflows.

Think of variables as placeholders that can be used to store data. Once data is stored in a variable, it can easily be accessed at any time by your workflow.
For instance, you can store text in a variable and reuse it later.
As a first example for this tutorial, we will demonstrate how to do this. It is very easy.

In Action(s), variables can be found in the Variable category in the library. They are represented by a V in a blue or purple box. Blue boxes are storage variable and purple boxes are run-time variables. We will explain the difference between the two a little bit later.

To add a variable into your workflow, simply double-click on it. In our example, we will need a variable that can store text, so we will double-click on the New Text variable. A new section now appears at the bottom of the workflow, where all the variables available to our workflow are held. By double-clicking on the variable name, we can edit the variable name in order to give it a more appropriate name.
Now let’s define how the variable value will be filled. First let’s add an Ask for text action. This Action can be found in the Text category. When we execute the workflow, this action will ask us to input a text. Since we want to rename a file, change the question to: “Enter the file name:” The question requires an answer, so let’s select the Require an answer check box.
This action returns the input received. What we want now is to store this result into our variable. To do so, we will drag the variable into the workflow. A panel appears. By checking the Set the result of the previous action as a new value for the variable box, we ensure that our text result will be stored in our variable.
Next we will use the content of the variable to create a new file. For example, let’s take a screenshot and save it on the desktop using the variable content as the file name. To do so, locate the Take Screenshot action in the Other category and add it to your workflow. To use the variable content as a file name, remove the current file name, then drop the variable into the file name field. You can see that the file name is now the name of the variable between the percentage signs. During the workflow execution, it will be replaced by the content of the variable.

And we’re done! We can now run our workflow and admire the results. The workflow asks for a file name. The workflow will take a screenshot and save it on our desktop using the file name we provided. It is that easy!



A little bit earlier we stated that in the Variables category, variables can be of two different colors – blue or purple.
There is a big difference between both of them:
Blue variable are storage variables. This means that they can be used to store and retrieve data, as we saw in the first example.
Purple boxes are run-time variables. Contrary to the blue variables, their content cannot be changed and is dependant of the environment. They contain information specific to your computer. For example, the variable Computer Name contains the name of your computer. If you create a workflow with this variable and execute it on another computer, the result will be different, because the other computer will have a different name.
Some run-time variables can even change every time you execute your workflow. For example Current Date will contain the date the workflow is executed. If you run your workflow today, it will contain today’s date. If you run it tomorrow, it will have tomorrow’s date.

Now you know how to use variables in Action(s). There is no limit to what you can do with them and they will help you make your workflows even more powerful.

Visit http://app.jbbres.com/actions for more information about Action(s).