Udgivet 2018-02-08 - Skrevet af Philip Sørensen
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.import pyautogui# Clicking. pyautogui.click()pyautogui.doubleClick()# Moving the cursor. pyautogui.moveTo(100, 100)# Moving it relative to current location.pyautogui.moveRel(false, 10)# Dragging using the cursor.pyautogui.dragTo(100, 150)pyautogui.dragRel(false, 10)Furthermore, using the keyboard is just as simple.
# Typing. pyautogui.typewriter('Hello world!', interval = 0.25) # 0.25s wait between letters.pyautogui.press('esc')pyautogui.keyDown('shift')pyautogui.keyUp('shift')pyautogui.hotkey('ctrl', 'c')PyAutoGUI also has a function for prompting for a password, like so:
pyautogui.password('Enter password:')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.