Using Mappings and Variables in your Elephant Automation Macro

Learn how to connect the outputs of one step to the inputs of another step and how to use a variable in your Elephant Automation macro.

In this video you’ll learn:

  • What a mapping is
  • What a variable is
  • How to connect the outputs of one step to the inputs of another step
  • How to store values in a variable

[TRANSCRIPTION]

Hello and Welcome to Elephant Automation.  I’m Nathan Maus and in this video, we’re going to discuss the quintessential topic of mappings and variables.  The first order of business is defining what a mapping is.  In Elephant Automation, our tools have both inputs and outputs.  The inputs change how the tool works, the tool does some stuff and then the tool sets it’s outputs.

What’s really powerful is grasping how to use one tools outputs to link up to another tools inputs.  This is what a mapping does.  It allows you to Map the output of one tool to the inputs of another tool.

Let’s go through a simple example.  We’re going to get a user input and then type it into a text field.

Here’s an example, where we’ve already setup a Simple Input to take input from a user and we’ve got an execute command to open up an instance of notepad, we’ve got a mouse click to gain focus on the text field and we’ve got a keyboard input tool ready to type something in.  Our Simple Input tool will allow us to enter the persons name, which we will then add to the text which we’ll type into the notepad.

What do we want to type into the notepad?  How about “Hello Person, How can I help you?”  That works just as well as anything else.  What we want is to replace Person with a mapping to the persons name that they enter into the Simple Input tool.

A mapping is just some text you enter into the input that is in a special format.  To format a mapping correctly, you start with a percentage sign, then the step number, then a comma, followed by the output name you want to map to, and finally closed with another percentage sign.

Let’s look at it in practice.  First we, go to the output we want to map to and copy the output’s name.  Then we go to the input we want to use the output in and enter our map.  Type two percentage signs.  Then go inside them and type the step number, which in this example is step 2, then a comma, and paste in the output’s name.

There you’ve created your first mapping.

Now let’s run it and see how it works.  First we get to enter our name.  Then it moves through and we’ve got our name placed correctly in notepad.

So we now know how to map to another steps outputs, but we can also map to a variable as well.

So that begs the question, what is a variable?  A variable is just a symbolic representation of a container that holds a value.  One of the main advantages of using a variable is that you give it an easy to remember name, which makes it easier to create the macro and easier to read.  If you only are going to map to the output once, you probably should just map to it directly.  It’s easier and cleaner, but if your macro could use an input from several locations, or if you want to keep track of the same thing conceptually, than it just makes sense to use a variable.  You can change the value of a variable anywhere in your macro as you aren’t tied to one specific step number.

To get the value of a variable, you just use two percentage signs surrounding your variable’s name.

To set a variable.  You use the Set Variable tool, which you just enter the value you want to use for your  variable.

So let’s add a variable to our first example, just to show how it works.  We add the Set Variable tool to our Macro.  We’ll copy our old mapping and use that to set our variable, and we’ll call our variable PersonsName.  Next, we’ll go to our keyboard step and map it to our new variable instead of directly to the output.  To do this we simply put the variable’s name between the percentage signs and we’re good to go.

So now you know how to use mappings to link outputs and variables to the inputs of a step.

Thanks for watching.  If you found this video useful please, like and share this video.  If you have any questions feel free to leave them in the comment section below or send them our way via email, which you can find on our website.

Leave a Reply

Your email address will not be published. Required fields are marked *