pyautogui is a python module to automate keyboard and mouse actions. I found this very interesting and creepy too ! :).

Here are few things to ๐Ÿ“ note,

  • Tried installing on python 2.7, was not successful
  • Use python 3.x to install pyautogui
    • pip3.7.exe install pyautogui

Sample Script

Open a application in taskbar and close it using mouse clicks. –> move cursor on application, then in python3.x console run the following code and –> Note position of application in taskbar –> note position of “close” button

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyautogui
>>> pyautogui.position()
Point(x=396, y=591)
Point(x=1884, y=0)

Simple Python code to open and close application (very basic :) )

import pyautogui
decision = 'OK'
while (decision == "OK"):, y=1048, clicks=1, button='left', duration=3), y=21, clicks=1, button='left', duration=3)
	decision = pyautogui.confirm ('Should I continue ?')