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.

Leave a Reply

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