Click with pressed key Topic is solved

Ask gaming related questions (AHK v1.1 and older)
michelxd15
Posts: 132
Joined: 08 Aug 2019, 02:02

Click with pressed key

09 Aug 2019, 21:18

Hi Guys, I'm coming here again to ask a question.
Is it possible to create a macro where a key was pressed and the mouse make two clicks one in one position and another in another?

I'm kind of new to autohtk and I wonder if anyone could help me with that

in the case it would be holding the CTRL key and the first click would be with the right button and the second with the left button, both clicks would have to be with the "CTRL Pressed" key.
Rohwedder
Posts: 7625
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Click with pressed key

10 Aug 2019, 09:41

Hallo,
one position and another position means right and left mouse button?
Try with Hotkey F6:

Code: Select all

*F6:: ;* Fires the hotkey even if extra modifiers are being held down
Click right ;first click with the right button
Click ;second click with the left button
;Click does not automatically release the modifier keys (Control, Alt, Shift, and Win)
Return
michelxd15
Posts: 132
Joined: 08 Aug 2019, 02:02

Re: Click with pressed key

10 Aug 2019, 11:54

yes, it would be two clicks starting with the right button, and then with the left, remembering that I would need the ctrl key to be held at the beginning of these 2 clicks, and in this case I would execute this script with the number 5 of my numpad

@Rohwedder
Rohwedder
Posts: 7625
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Click with pressed key

10 Aug 2019, 12:16

Then simply:

Code: Select all

^Numpad5::Send, {Ctrl Down}{RButton}{LButton}{Ctrl Up}
michelxd15
Posts: 132
Joined: 08 Aug 2019, 02:02

Re: Click with pressed key

10 Aug 2019, 12:26

Right, but how do I position the click's? I already know the position by window spy, but I don't know where I put it here
^Numpad5::Send, {Ctrl Down}{RButton}{LButton}{Ctrl Up}
@Rohwedder

this is possible ?
example : ^Numpad5::Send, {Ctrl Down}{Click, 680, 259, right}{Click, 680, 251, Left}{Ctrl Up}
Rohwedder
Posts: 7625
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Click with pressed key  Topic is solved

11 Aug 2019, 01:40

Of course it's possible!
Sometimes it helps to slow down the mouse cursor for testing:

Code: Select all

^Numpad5::
SetDefaultMouseSpeed, 30
Send, {Ctrl Down}{Click, 100, 400, right}{Click, 400, 100, Left}{Ctrl Up}
Return
michelxd15
Posts: 132
Joined: 08 Aug 2019, 02:02

Re: Click with pressed key

11 Aug 2019, 21:56

thank you friend good job

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 92 guests