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.
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.
setcursor 100 50
You can then perform a primary-button mouse-click by using the command
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