Monthly Archives: December 2012

Creating a Message Box in Elephant Automation Macro

Message Boxes are one of the primary methods that your macro can communicate with its users.  It should be one of the fundamental tools in your toolbox, so watch the above video to learn how to use them to their fullest extent.

In this video you’ll learn:

  • What a message box is
  • Message boxes output which button was pressed
  • Use an if-else statement to do different things depending on which button was pressed
  • Use a message box to pop-up information while programming

[TRANSCRIPTION]

Hello, Welcome to Elephant Automation, I’m Nathan Maus and in this video, we’re going to learn all about Message Boxes and how to create them.  Message Boxes are small pop up windows that contain some text, possibly a picture, and a set of buttons.  You can use them to provide information to your users.  You can use them to ask the user a question.  With a nice picture you can use them to guide your users through some of the more challenging operations they’ll face.  You can even use them as a training tool. Continue reading

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.

Working With Windows in Elephant Automation

All programs these days seem to come with graphical user interfaces.  This video will show you how to change their size and location so that you can create layouts for your windows so that your macros work perfectly every time.  You’ll also learn the basics of how to manipulate windows no matter where they are on the screen.

In this video you’ll learn:

  • What a window is
  • How to define a window in Elephant Automation
  • How to interact with a window no matter where it is
  • How to resize a window
  • How to move a window to a specific location
  • How to create a layout

[TRANSCRIPTION]

Hi, welcome to Elephant Automation.  I’m Nathan Maus and in this video I’m going to teach you how to execute programs and manipulate windows, so that you can be the master of your workspace.  First for any true beginners out there, let me define what a window is.

For this video, we’re going to define a window as the part of a computer program’s user interface that is surrounded by a frame and has the Title Bar and some buttons to minimize and maximize the program at the top.  This is also called a top window in the programming world.

It’s also important to know that a window can be active or inactive.
The active window is usually the last program you clicked on or interacted with.

Often times you can tell which window is active because there will be a visual cue that makes it look different.

In Elephant Automation, most of our tools work directly on the active window.

Some of our tools are designed to work on specific windows regardless of whether or not they are active.

For these tools, we interact with the window by first giving the window a name and then selecting the window from a list in the tools properties.

Let’s look at the two tools that are available for labeling windows.  The first tool is the Define Window tool.  The Define Window tool is used when you want to label a window that already exists, ie the program is already running.  The second tool is the Execute Command tool, which is used to run a command from the command line.  If this command results in a window being created, than you can easily add a label during this step.

For the Define Window tool, we have two options.  The first is that we can simply pick whatever window is on top of or in front of all the other windows, the second is that we can choose a window based on it’s title.

Choosing the foreground window is pretty straight forward, but there’s a few things to think about when you are using the By Name option,

It mainly comes down to being aware that if you have multiple windows that all fit the criteria of the window you are looking for, then you will get unexpected results, so be precise when defining windows.  This is good for working with windows that are already open, but it is not my preferred method.

My preferred method of labeling windows is to use the Execute Command tool.  What this tool does is execute the command found in this input and once the command is completed we have the option of giving the window a name by using the Define Window option.  I like this better, because this tool grabs the specific window created by the step, so there’s no confusion about which window you’re working with.

An interesting quirk in windows is that the command and it’s parameters are separated by spaces so if you’re using a file path with spaces in it, you must enclose it with parentheses like this.

One last thing with this tool is the Post Execute Sleep option.  Usually the default setting is fine, but if you notice that the Macro tries to move ahead too quickly before continuing increase this value.  This waits for any changes the program makes after the User Interface loads.

Ok, now that we know how to give a window a label, I’d like to show a couple things we can do with a window once we have a label.

One of the more useful tools for manipulating windows is the Set Window Parameters tool.  This tool is used for adjusting the size and location of the window with respect to the desktop.  You can set it to any arbitrary size or you can minimize, maximize, and restore a window.

You can also use this command for closing a window.

Another way that you use a label is for using tools that are coordinate specific.  For example the mouse input tool will click on a specific x,y coordinate and the capture image tool will capture a rectangular image between two different x,y coordinates.  Both of these tools allow you to specify the window as your coordinate system.  This ensures that no matter where on the screen the window is, that the tool always clicks on the right button or captures the right image.

Now that you know how to adjust the size and location of your windows and work within windows, you can set your macros up for success, by being as consistent as possible in your layouts.

If you have any questions, I’d love to hear them in the comment section below or send us an email via the elephantautomation.com website.  If you liked this video please link to it, like it and share it with people who’d gain some benefit from it.

Thank you for your time, have a wonderful day, and see you soon.

Automatic Keyboard Typing in your Elephant Automation Macro

The keyboard, along with the mouse, is one of the foundational ways to interact with your computer.  Today, we’ll learn how to control the keyboard automatically using Elephant Automation

In this video you’ll learn:

  • How to create a keyboard macro
  • How to type keyboard automatically
  • How to send key combinations to an application
  • How to type special keys
  • How to repeat a key or key combination
  • How to navigate application menus using keyboard

[TRANSCRIPTION]

The Keyboard Input tool is used to simulate a human typing on the keyboard.  You can use it to enter text into the program, navigate menus, tab through a program, or enter key combinations like Ctrl-C and Ctrl-V.

The first thing you do is to set the input mode.  You’ll quickly find that the last 3 options are practically identical.  They are designed to make it simple to do a quick key combination without having to remember any of the intricacies of the Send Keystrokes to Application option.  All you have to do is click on the modifier keys you want to use and then choose a
letter, number or key to use with it.

However, the real power comes in using the Send Keystrokes to Application option.  Let’s start by entering text into a field. We’ll open notepad and click on the area where we want to enter text.  Then in the keyboard Input tool, we’ll enter some text that we want typed into notepad.

We’ll run it and as expected it simply types the text into notepad.

Now, lets use a mapping to add text from an output into what we type.  We’ll use a simple input to get a persons name, then we’ll add the mapping in the Keyboard Input step.  Here’s what it looks like when it runs.

If you look at your computers keyboard, you’ll notice that not all the keys are 1 letter long.  For special keys, we use a set of curly braces around a key code.  For example, the ENTER key would be represented as curly brace ENTER curly brace.  The F2 key would be curly brace F2 curly brace.  For a list of all the key codes, check out the link below this video.

In order to understand the Keyboard Input step fully, we need to discuss key combinations.  Key combinations are simply multiple keys pressed at the same time.  The most famous key combination is probably CTRL-ALT-DELETE.  There are two ways to do key combinations within
the Send Keystrokes to Application mode.  The first is to use a modifier and the second is to use parentheses to surround the entire key combination.

There are 4 keys that Elephant Automation recognizes as modifiers.  The CTRL key, the ALT key, the
SHIFT key, and the Windows key.  They are represented by the carat key, the exclamation key, the plus key and the pound or number key.  How modifiers work is that the key following the modifier is added to the key combination the modifier started.

Here are some examples of common key combinations.

In the properties page, there is a Send letters lowercase when inside a key combination option.  This is sometimes necessary, because when you use a capital letter, what is actually typed is shift and the key.  Some programs don’t care if you add the shift in there and some do, so it really depends on the program your automating.  Most of the time you should just leave it set to default and only uncheck it for specific needs.

Another way to do key combinations is to use parentheses to surround the keys.  This has the advantage of being able to use any of the keys even if they aren’t modifiers.  One thing to note is that you can interchange modifiers and parentheses.

All of these examples are valid key combinations.

At some point in time, you’ll probably have the need to repeatedly press the same character many times in a row.  This is how we do it.     We put the key in curly braces like a special key, add a space and then the number of times we want it to repeat.  For key combinations, we use the parentheses method and after the last key we add a space and then the number of times we want it to repeat.

There are two cool features of this tool I haven’t mentioned yet.  These are non typing actions that you can trigger while in the middle of automatic typing.

The first is SLEEP.  You use the sleep command to put a pause or delay between key strokes.  This is nice if you have to wait for a small period of time for something to happen before continuing.  The second feature is called CLIPBOARD.  In the property page, there is this the Use clipboard to paste text when applicable option.  This is useful in that instead of having to simulate each keystroke, all you have to do is simulate Ctrl-C and Ctrl-V, so this offers a dramatic time savings,

Let’s explore using these commands while we learn to navigate some menus in a program.  We’ll add another keyboard input step to navigate the menu bar.  The first thing to do is to use the ALT key to activate the menu bar.  You navigate by using the underlined letters.  One common example to try is ALT-F-S which is usually used for saving your current file.  Another one is ALT-F-X which we’ll use for exiting the program.  This will pop up a prompt for us asking if we want to save or not.  We use the sleep command to put a little pause in there to let it load in case the system is slow.  When we navigate menus, we need to send the actual keys themselves rather than a command to paste from the clipboard.

Automatic Mouse Click – Using the Mouse in your Elephant Automation Macro

The mouse, along with the keyboard, is one of the primary ways of interacting with your computer.  This foundational video will show you how to use your Elephant Automation macro to control another application by clicking on the mouse automatically.

In this video you’ll learn:

  • How to create a mouse macro
  • How to automatically click the mouse
  • About EA Window Spy
  • About mouse coordinate systems

[TRANSCRIPTION]

Hi Welcome to Elephant Automation.  I’m Nathan Maus and in this video, I’m going to teach you how to use Elephant Automation to control your mouse.  This will let you click on buttons, highlight stuff to be copied or to gain focus on a cell so you can type text in it.

These are the inputs for the Mouse Input tool.  Each Mouse Input step has a coordinate system and a set of X, Y coordinates.

There are 3 different options you can use for the coordinate system.  When using the screen as your coordinate system your X, Y coordinates are based off the upper left hand corner of your screen.  Positive numbers are down and to the right.

The second option would be any of the windows you’ve defined, in which case, the X, Y coordinates are based off the upper left hand corner of the defined window.  This will also bring the window to the front if it’s hidden behind other windows.

The last option is to base it off the last mouse event.  By far the most common usage is the second one which is based off the window.

Elephant Automation comes with a helper utility program called EA Window Spy which you can use to determine what numbers to use for the X and Y coordinates.  You also need to choose a button and an action.  If you choose None for either the button or the action, all it will do is move the cursor to the location, but it won’t click on anything.

Thanks for watching, If you got some value out of this video, like it or share it with others who could use it.  If you have any questions, please ask them below in the comment section or send us an email via the form on our website.  Have a great day and see you soon.

How To Create a Macro – Getting Started with Elephant Automation

[TRANSCRIPTION]

Hi, I’m Nathan Maus and in this video I’ll guide you through making your first macro with Elephant Automation.

This is Elephant Automation. In the Left Panel, we have all the tools we need to create our macro. A tool is a bunch of computer programming stuff all compressed into one little easy to use chunk. A tool usually has some inputs or parameters which you can use to change what exactly the tool does. A tool also has outputs which you can map to other tools inputs.

In the Center Panel, is where we build and edit our Macro. A Macro is simply a bunch of tools with specific inputs and outputs executed in a particular order. Usually we call them tools when we refer to them genericly and steps when we talk about them specifically.

In the Right Panel, is where we adjust the inputs and outputs of a particular step.

Alright, lets get started making our very first macro.

First, let’s drag the Execute Command tool into the macro. This tool let’s us execute a command as if it were in the windows command line. We’ll enter Notepad into the command input. When we execute this step, it will open up an instance of Notepad. We will make sure the Define Window option is checked and give this instance of Notepad the name Notes. By naming our windows, we can later use other steps to work on them by name.

Now let’s add the Set Window Parameters tool to our macro. This tool lets us change the size and location of our window. Let’s give our Notepad a height and width of 300 and an X and Y location of 100.

Now let’s run our Macro. First we use the mouse to highlight the top step. The macro will start executing from whatever step is highlighted but most often you’ll want to execute from the beginning. Then we’ll want to click on the Play Macro button. As you can see Elephant Automation opens up an instance of Notepad, sets it to the correct size and moves it to the correct location.

Next we’ll want to add the Mouse Input and Keyboard Input tools to our macro. This will let us click on the text editing portion of Notepad and then we will be able to type into it. Let’s set our coordinate system to Notes. This ensures that the mouse will be clicked with respect to the specific notepad we previously called Notes. We’ll set both the X and Y Location to 100. We’ll leave the button and action at their default settings to perform a left click.

In the Keyboard tool, we enter whatever it is that we want to be automatically typed into Notepad. Ok now lets run our Macro again and ensure that it works like we expected. Perfect.

Now lets create 3 more Notepads and arrange them in a nice grid so that each Notepad takes up a quarter of the screen. Ok now we have 4 Notepads, but lets be sure to give them different names. Now we add 3 more Set Window Parameter steps and we set each of them to work on a different window.

To get them to each take up a quarter of the screen, we have to know the screen resolution of the monitor, so let’s add a Get Screen Resolution step to our Macro. The Get Screen Resolution tool does exactly what it seems, in that it gets the screen resolution and returns the Width and Height of the screen so that we can use it as a base for when we change the size and location of our windows.

To map the output of the Get Screen Resolution tool to the inputs on our Set Window Parameter tools, we simply put the step number and the output name inside a pair of percentage signs like this. Now let’s do the same for the height. And we can’t forget that we want half the screen width and half the screen height.

Now let’s copy these for the rest of the steps.

Similarly, we can do the same to set the inputs for the locations of the Notepads. This will give us four notepads in the grid like pattern we desire. This is useful if you want to set up different programs in a specific manner to make them easy to work with.

Now let’s copy and paste the Mouse and Keyboard steps. One for each Notepad. We also have to change the coordinate system in each mouse step to refer to a different Notepad.

Works perfectly. Now lets use the Group tool to clean up our Macro and make it easier to read. We just move all the steps we want into the group and then we can rename the group something a little more descriptive for our particular application.

Now let’s automatically close all the windows. This will show us how to navigate through the programs menus using the keyboard. We use the Alt button to get to the menu bar, The F button for the file menu, the X button for the Exit option, and the N button so we Don’t save the file. So ALT F X N

So we add a mouse input and a keyboard input just like we did before.

And we enter ALT F X N, where the exclamation point stands in for the ALT button.

Now let’s copy and paste them 3 more times and add them to their own group for legibility. Let’s make sure we’re pointing to the right Notepads.

Alright, lets run the macro and see how we did.

Works Perfectly.

Thanks for watching this video, Get started making your first Macro as soon as possible, and if you have any more questions, check the elephantautomation.com website or our youtube channel for more help. Also if you found this useful or have any comments feel free to comment on, like, and share this video. See you next time.