How to write a robot for automating tedious tasks in Python
Business' are always looking to automate or streamline their workflow, it frees up employees to focus on what they do best. In Denmark this has really been the focus for both banks and municipalities as of late. They have a lot of tedious business processes that should and could be handled by software. This type of software is called Robotic Process Automation (RPA), because just like a physical robot at an assembly line these “robots” can be programmed to do specific tasks at a high capacity.
How does RPA work?
The RPA program, or robot, automates certain actions on a computer by utilizing the Graphical User Interface, for example by clicking through menus or filling out forms. Basically anything you can make a computer do with your keyboard and mouse a robot can be programmed to do. The catch, however, is that the robot does the same thing everytime, which means that any change to the GUI will break the program.
Companies pay dearly for expensive software to enable them to create their RPA robots, but amazingly enough you don't even need to pay to be able to create them. You can do it for free.
How to create a RPA robot
You can create your own robot in Python through the cross-platform PyAutoGUI
module. Using the cursor is quite simple as seen below.
# Moving the cursor.
# Moving it relative to current location.
# Dragging using the cursor.
Furthermore, using the keyboard is just as simple.
pyautogui.typewriter('Hello world!', interval = 0.25) # 0.25s wait between letters.
PyAutoGUI also has a function for prompting for a password, like so:
There are really so many opportunities with this Python module. Think about it next time you are at work and some of your tasks start being tedious. It can be automated. Of course, you need to consider whether it's worth the time as XKCD put it.
I hope this quick guide to automation gave you some ideas for streamlining your workflow. Start automating tedious tasks at your work today!
Der er ingen kommentarer.