I have checked out the recommendations of this page. However, I've found that "AutoHotKey" has a pretty steep learning curve and "Auto Mouse Click Generator" does not have the functionality I want. Is there a free software that I can record / specify a left mouse at a specific X-Y location on the screen via a shortcut (i.e., SHIFT + E).

What I like to do is to combine human manual mouse click and use the pre-recorded shortcuts to automate the other part. For example, I like to create a short-cut to do a left mouse click at X=150, Y=150 as SHIFT + E.

Then I can manually click where I want on a screen > then SHIFT + E > then some other human input > then SHIFT + E.


You can accomplish this task using NirCmd by NirSoft. It is generously provided as gratis software from Nir Sofer, the author. It is not currently open-source, but that was not mentioned as a requirement.

You can set the cursor position using the setcursor [X] [Y] command. From the documentation:

Set the position of mouse cursor. The [X] and [Y] parameters specifies the desired cursor position. Example: setcursor 100 50

If you want to set the position relative to the active window, you can instead use the setcursorwin [X] [Y] command. From the documentation:

Set the position of mouse cursor, relative to the top-left corner of the active window. The [X] and [Y] parameters specifies the desired cursor position.
Example: setcursor 100 50

You can then perform a primary-button mouse-click by using the command sendmouse click.

Because you will be performing multiple commands, create a small script file with the commands, which is just a basic simple text file.

Then you can call all the commands at once using NirCmd's script functionality. From the documentation:

script [Script File]
This command allows you to execute a sequence of commands stored inside the file specified in [Script File] parameter.

To tie it all together, you can then create a shortcut with any hotkey to your command script using the cmdshortcutkey command. It has the syntax:

cmdshortcutkey [folder] [shortcut title] [hot key] [command]

The NirCmd help file will be your friend and guide to help you with any additional details.

Links for you:

NirCmd Home Page: https://www.nirsoft.net/utils/nircmd.html
NirCmd 32-bit (with .chm help file) download: https://www.nirsoft.net/utils/nircmd.zip
NirCmd 64-bit (with .chm help file) download: https://www.nirsoft.net/utils/nircmd-x64.zip
NirCmd Online Help File: https://www.nirsoft.net/utils/nircmd2.html#using
NirSoft Home Page: https://www.nirsoft.net/
NirLauncher Home Page (includes NirCmd and over 200 other free quality tools): https://launcher.nirsoft.net/downloads/index.html

  • Thanks, but I try nircmd setcursor 1650 962 sendmouse click, it sends the mouse to the right location, but doesn't actually click.
    – KubiK888
    Jul 8 at 3:00
  • I am able to create a shortcut key, but after I execute the shortcut, it takes more than one second for the mouse starts jumping to the desired location. Is this much lag normal? Is there a way to reduce the latency?
    – KubiK888
    Jul 8 at 3:21
  • To sequence more than one command after another, you either need to use the NirCmd's script functionality (very simple: just create a text file with all the commands), or run a separate instance of NirCmd with each command (it's not possible to chain them on a single command line as you've done, although that would be a great feature!). Jul 8 at 4:26
  • Regarding lag, one second seems unusually long. Try running NirCmd directly from the command line (without a shortcut key) to see if there is any lag. Even on a fairly slow machine, running a NirCmd command should be almost instantaneous. Jul 8 at 4:28
  • 1
    You're welcome. Glad to help. Thank you for the link to the lag Q/A. I actually have never experienced it, but as you determined, others certainly have. I actually had that Q/A bookmarked just in case it ever happened to me, but I completely forgot about it, as I bookmarked it almost a decade ago! Jul 8 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.