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

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: 17706
Joined: 21 Dec 2014, 02:44

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

10 Feb 2024, 19:26

Code: Select all

CoordMode, Mouse, Screen
4::Click % (A_ScreenWidth / 2) "," (A_ScreenHeight / 2)
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: Left click in specified location when key is pressed

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.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: LJC2004, Strat919 and 37 guests