top of page
Writer's pictureDiniz Martins

Mouse & Keyboard Bot

This article illustrates how to automate mouse and keyboard movements using pyautogui module in python. This module is not preloaded with python.


So to install it run the following command:

​pip3 install pyautogui

The code shows how to move the mouse using coordinates and send a message in predefined seconds.


Code:

import pyautogui as pg import time def codehere(): pg.click(807, 979) pg.typewrite("hello") pg.typewrite(["enter"]) time.sleep(2) pg.click(1621, 896) pg.click(1621, 896) # time.sleep(1) pg.click(1693, 859) # time.sleep(1) pg.click(1014, 669) # time.sleep(1) pg.click(1111, 605) a = 20 time.sleep(10) while (a != 0): codehere() a = a - 1

You can run the script, open your notepad or WhatsApp and see the message sent.





22 views0 comments

Recent Posts

See All

Fake Data in Python

If you are developing applications, testing your software, or just exploring Python's capabilities, you might have faced a situation...

Mobile | Secret Phone Codes

Our smartphones have become extensions of ourselves, facilitating much of our communication and storing troves of private data. If...

Edit a Website with a Java console

Edit a website – even if it’s not yours! This is how you can edit any website directly from your browser: #1) Open a Webpage; #2)...

Comments


bottom of page