Click hold right click not working Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Jay311
Posts: 2
Joined: 21 Jan 2022, 11:36

Click hold right click not working

Post by Jay311 » 21 Jan 2022, 12:36

I am trying to make a key hold a keyboard button along with left or right click. Then release them when I release the button. Everything works fine with the left mouse button. However when I try it with the right mouse button the click does not hold. It instead spams right click.

This works:

Code: Select all

*F7::

While GetKeyState("F7", "P")
{
	Send {LControl Down}
	Send {Click Down}
	
}
Send {LControl Up}
Send {Click Up}


This doesn't hold RMB it seems to hold ctrl but spam right click.

Code: Select all

*F8::

While GetKeyState("F8", "P")
{
	Send {LControl Down}
	Send {Click, Down Right}
	
}
Send {LControl Up}
Send {Click, Up Right}
[Mod edit: [code][/code] tags added.]

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

Re: Click hold right click not working  Topic is solved

Post by boiler » 21 Jan 2022, 12:45

Don’t send the down click inside the loop. You shouldn’t in your first one either, even if it happens to work. You don't even need a loop if you use KeyWait. Try this:

Code: Select all

*F8::
	Send {LControl Down}
	Send {Click Down Right}
	KeyWait, F8
	Send {Click Up Right}
	Send {LControl Up}
return

Or simply this:

Code: Select all

F8::^RButton

Jay311
Posts: 2
Joined: 21 Jan 2022, 11:36

Re: Click hold right click not working

Post by Jay311 » 21 Jan 2022, 14:02

boiler wrote:
21 Jan 2022, 12:45
Don’t send the down click inside the loop. You shouldn’t in your first one either, even if it happens to work. You don't even need a loop if you use KeyWait. Try this:

Code: Select all

*F8::
	Send {LControl Down}
	Send {Click Down Right}
	KeyWait, F8
	Send {Click Up Right}
	Send {LControl Up}
return
Thank you this worked perfectly.

Post Reply

Return to “Gaming Help (v1)”