Left click in specified location when key is pressed

Ask gaming related questions (AHK v1.1 and older)
gelobello
Posts: 3
Joined: 18 Jan 2024, 11:39

Left click in specified location when key is pressed

Post by gelobello » 10 Feb 2024, 19:08

Hi. I'm fairly new to creating/making scripts since I just discovered this about a month ago and I noticed most of the people in the game I'm playing are using AHK.
Could anyone help me or it is even possible to make a script that when pressing the desired key will make a 'left click' on a specified position on the screen?

For example, when I click number 4 it will move the cursor at the center of the screen and will automatically press left click?

Thank you so much in advance to anyone who can enlighten me on this topic!


[Mod edit: Replaced subject "I'm a newbie. I need help pelase." with descriptive subject.]

User avatar
boiler
Posts: 17393
Joined: 21 Dec 2014, 02:44

Re: I'm a newbie. I need help pelase.

Post by boiler » 10 Feb 2024, 19:26

Code: Select all

CoordMode, Mouse, Screen
4::Click % (A_ScreenWidth / 2) "," (A_ScreenHeight / 2)

User avatar
boiler
Posts: 17393
Joined: 21 Dec 2014, 02:44

Re: Left click in specified location when key is pressed

Post by boiler » 11 Feb 2024, 07:24

@gelobello - Please note that the subject was changed from "I'm a newbie. I need help pelase." Everyone posting in the "help" part of the forums needs help. Please use a subject that is descriptive of your problem like the one it was replaced with. Thank you.

Post Reply

Return to “Gaming Help (v1)”