Learn how to develop automated interactivity workflows by creating a task that uses the Interactivity and Input Actions to write to a data entry application. Pat Cameron, Director of Automation, gives you a guided tutorial on setting up an interactivity report task in Automate. In this video you’ll learn how to:
- Add variables and format the text
- Capture the attributes of an object with Automate
- Use the different options in the Input Action such as send keystrokes, move mouse, and block input
Watch this chapter now to learn more.
[Pat Cameron:] We're going to create a task that uses the interactivity and the input actions to write to ... we're just going to write to a Notepad screen, but you could use this to write to any of your applications, where you need to do some type of data entry into a screen, etc. We're going to keep this one simple.
[00:00:30] The first thing that we're going to be doing is, we're going to add a variable to this task, and we're going to add today's date. I'm going to add that to the texts that we're writing out to the Notepad screen, and then we find the format. We're going to format the date and the time, how do we want it to look when we're writing it out to text? You can select from a list of available options, or you can create your own. But we're going to use this to just update [00:01:00] that variable for today.
Now we're going to go back to the interactivity and the input actions. When you're creating an interactive task, it's probably going to be a combination of these two actions that you'll be using.
The first thing that we want to do is, we want to move the mouse to an object on the screen. I've got a shortcut on the taskbar to open up Notepad. To use that control for interactivity, [00:01:30] point and click on that magnifying glass, and just hold the left mouse button down, and you'll see it will highlight any of the options on the screen where we can move the mouse. We're going to let go of the button and then what Automate will do, is it will get all the attributes of that object, where you've point and clicked.
You can see here that it will capture the X and Y coordinates as well, but typically we don't like to use those. It's a lot more efficient if you use [00:02:00] the object attributes to be able to select the object that you want.
Then the next thing that we're going to do is, we want to click that mouse button. Now we've moved the mouse over to the object, and as you can see, we have a number of different options here. We will be using the send keystrokes in this, it has a move mouse as well, but it only picks out the X and Y coordinates, so we're going to use the interactivity for that. Here, we're just going to do a single mouse click.
[00:02:30] Now, if we go ahead and run these guys, you'll see that it will move the mouse down to my Notepad shortcut, and then click the mouse button, which will open up Notepad.
The next thing that we're going to do here is, we're going to just put a wait in here. We search on wait, and what I want to wait for is that Notepad window to be open. If you have an application that the [00:03:00] screen might not open up right away, you don't want to start entering keystrokes until that's open, so we're just going to add a wait for the window and then we're going to just wait for that Notepad window to go ahead and open.
You can see you've got others, you might want to wait for the window to gain focus as well. You might want to look at some of the contents on a window, so it's going to depend on the application, but we're just going to use that default right there.
The next thing that we'll do then is, we're going to go back [00:03:30] to the input action, and we're going to send some keystrokes to this Notepad file. We select send keystrokes and drag it over to that work area. As you can see here, you can block input, hold the key, and release the key. Again, it's going to be depending on your application. But we're just going to use the simulate keystroke, so I'm just going to type in here the keystrokes that we're going to add [00:04:00] to that Notepad file.
But again, this could be some data entry into your application. First, you need to find the field on the screen, and now you need to enter the data that you need to enter into that field.
We're also going to add our variable in here, we're going to add the date and the time. When we get to that point, then we're going to click on that percent sign, it will bring us the list of variables available, and we're just going to use our var today.
[00:04:30] As you can see, you could be entering dates or other information that was gathered and stored in a variable into your application. You can encrypt the keystrokes, you can build in delays in the keystrokes, etc. Lock the keyboard and the mouse, so if this is running on your workstation, you can't move the mouse, Automate has control of it. You can certainly select different options that you might need when you're setting up your task with Automate.
We're going to run that [00:05:00] and see what it does. It'll open up Notepad, and then it's going to start entering those keystrokes, and this is today's date and time.
The other thing that we're going to do is, we're going to enter some special keys in here. We're going to put some space between the two paragraphs. Instead of just entering keystrokes, you can click on special keystrokes, and that shows you things like the tab, control keys, etc.
We're going to enter three times, and [00:05:30] you can do it either way. You can enter three times, or the other syntax that's available, you can enter and then a space between the number of times you want to press that enter key, and we're going to do it three times. Either way is fine, works. Get the same result. We're going to add that as our next keystrokes in there, so we get some space between our paragraphs.
Then the next thing that we're going to do is, we're going to write a second paragraph, and we're going to use the paste [00:06:00] keystrokes for this option. So you just, instead of simulate, paste characters, type in the characters that you want to paste. This might be used for copying and pasting from one spreadsheet to another, or from one document to another. We'll just type in the paste. We're going to use that same variable, so we're going to enter the date and the time in this as well.
Once you've found the [00:06:30] spot in the application where you want to enter the keys, it's very simple to just either type them in, or again, we could be reading them in from another source using variables to update the value of those keystrokes that you want to enter.
We'll put a little wait in between, just so we can see it when it runs. Again, very simple to add something in between, different lines of code that you have in your [00:07:00] Automate task. Just drag and drop them in between the steps that you want to perform.
Now, we're also going to move the mouse to an object. What we're going to do once we have those typed in, is we want to close this file. You can see, we're using that same move mouse and we're going to move it to the big red X so that we can just close this file. It's done exactly the same way, with that magnifying glass, find the option that you want to move the mouse [00:07:30] to. Then what we're going to do is, we're just going to click the mouse again. So we'll click that left mouse button, and that's going to close the file.
What's going to happen though when that file closes, is we're going to get a pop up screen, do you want to save it or not save it? We're going to use a couple different options for that. We're going to run the task to this point. We're going to open up Notepad, enter in our characters one-by-one, [00:08:00] couple of enter keys, paste in the next. Now, we've clicked on that X, but now what we've got to do is, we've got to press the right button here. Do we want to save this file? I'm not going to save it. In real life, you might want to, but we can use just the press option for this.
We're going to take that press, and we're going to drag it over so that it opens up the template for us. Same process, use the magnifying glass, and now it's going to highlight any of those buttons on the screen that we can press. We're [00:08:30] going to select don't save for this one, and okay this.
Now, when we run this task, it will open up Notepad, type in the data that we need, enter the variable values, paste in the next chunk, and then close it up and not save it.
There you go, we've created our first interactive task.