How to send clicks with Python aKa Emulate mouse clicks on Windows

There are some software available to emulate mouse clicks online, some free and some paid. But sometimes the best way to do it is just to use a simple script. It’s light, and it does not require you to install any suspicious software, so you are in control of what it does.

I had the need of emulate mouse clicks on Windows to automate some boring stuff I had to do, so I created a simple script to click on stuff for me, and I decided to share it with you.

If you are here looking for I script, I assume that you have a certain degree of coding and scripting, so I will not explain this in deep detail, but at the same time, I will try to help those with less knowledge.

First things first!

Before you download this script (or even after, doesn’t matter really), go to and download Python software.

Also, if you don’t have Notepad++, download it now, as you’ll need it too. This is all free software, so don’t worry.

After download, the obvious thing to do is to install it, do that.

If you haven’t done it yet, this is a good time to download my script now, using the link bellow.

When you download the ZIP file you will have 2 Python scripts, one is the “” and the other is ““, as the name implies, the file with “config” on its name will be the first file to use in order to config where to click.

Remember that I never coded in Python, so this is far from being perfect, but it works, and that’s the important bit! πŸ™‚

Let’s prepare the pre-flight!

Now that you downloaded and installed everything, let’s make sure everything will work fine!

To make things work better and smoothly, there is a small Windows setting/variable that we need to create.

Right click on “This PC” (named “My Computer”, on Windows 7), and click on Properties.

Now, click on “Advanced system settings”


Now click on “Environment Variables…

Now check, under “System variables” if you have a variable called “Python“, if you don’t have it, you need to press the “New…” button and create it, pointing to the folder where you installed Python.

Now that we have this out of the way, let’s start the party! πŸ™‚

Unzip the files you downloaded with the scripts, then right click on the “” and choose “Edit with Notepad++”, this will

In this file, you have some green text with some information and instructions.

Let’s install the needed modules first.

Open Windows Command Prompt from Start Menu.

Now type (or copy paste) the next commands one by one and press the ENTER key after each one.

pip install pynput
{PRESS ENTER and wait for installations to complete}
pip install colorama
{PRESS ENTER and wait for installations to complete}

Now that the needed modules are installed, just drag and drop the file “” to Command Prompt window and press ENTER.

What you will see is something like this…

Every 10 seconds, your mouse position/coordinates will be shown as numbers, for X and Y positions, you will need this numbers to setup your mouse click script.

Press CTRL+C on the black window to cancel the script.

Now, hopefully you still have “” opened on Notepad++, if not, open it now.

The numbers you had above, are the numbers in red that you will need to change on the Notepad++ code.

So, how do you automate stuff?

First, remember that this will need to be updated for any computer you use the script, because of different screen resolutions and other things on the screen (you will understand later when you play with the script more and more).

1 – Execute the script “” (drag it to the black window).

2 – Put the mouse over the place you want to click and wait for the coordinates to be registered/shown.

3 – Do this until you done with the clicks you want, keeping an eye on the script running. When you done just stop the script using CTRL+C, so no more positions will be recorded.

The red numbers are just little helpers, usually you should ignore the number 0, because this 0 position was where you had your mouse when you initiated the script, but not always.

Now all you have to do, is to update the red numbers for “” on Notepad++.

The code is very easy to read, so if you need more clicks, just copy and paste the code.

Let me know in the comments what kind of automated clicks you do with this script πŸ™‚


If you want to do a double click, use this code:, 2)

For right click is:, 1)

For middle click is:, 1)


Download the Python scripts here


Leave a Reply