Robotic Process Automation – GUI Automation Example

I have used RPA mouse and keyboard automation to open up sublime, enter text and then edit that text.

Full reference for what the commands do can be found on the repo for RPA.

All my RPA scripts can be found in my Github

The process of the script is;
1. Click start, find Sublime text editor int he start menu and click it
2. Enter text into Sublime
3. Locate a word in what was previously entered, double click it
4. Add more text overwriting that previously located word
5. Minimise all windows

This took me a little while to understand how the mouse automation works. You need to take your own screenshots, place them in the directory where the Python is running. Or use the base directory for Python to locate in the same directory as where the script is run from.

The screenshots are a little tricky to get to work. You cannot use scaling set to anything other than 100% when taking the screenshots and running the script.
The screenshots are of the images you want the mouse to click. So I have the start menu, sublime icon and a word. I’ll put these below.

All my screenshots were taken on Mac using Royal TSX RDP at 100% with Retnia option. Everything was very very small. But the mouse worked!

Start menu icon

Sublime Icon

Word to find and double click on

I think that the mouse automation works by taking a screenshot the screen and looking for the image that has been provided in the script.
If it cannot find it, the script will just continue. So clicking other things if it misses one, can cause problems. I had text being written on my script when it couldn’t find the Sublime text icon.
An error is sent to the console, but it is not stopped by default.

Script

Leave a Comment

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