Hold right click to hold right click and spam keystroke Topic is solved

Ask gaming related questions
Ejmb

Hold right click to hold right click and spam keystroke

17 Sep 2018, 02:04

I have this:

Code: Select all

$RButton::
   While ( GetKeyState( "RButton","P" ) ) { 

      Send, {4 down}
	Send, {Rbutton down}

      Sleep, 80

      Send, {4 Up}
	
	Send, {rbutton up}
      Sleep, 80

   }  
Except it doesn't do the regular hold right click, which I wish it would do. It's for World of Warcraft, where you face the way you right click+hold, and I want it to spam my "4" key while doing so.

So what I need help with is: When I hold right click, I want to issue the command: Hold right click + spam "4" key with delays, until I release right click.
Onimuru
Posts: 35
Joined: 08 Sep 2018, 18:35
GitHub: Onimuru

Re: Hold right click to hold right click and spam keystroke  Topic is solved

17 Sep 2018, 06:32

Try this:

Code: Select all

#SingleInstance Force
SendMode Input
Process, Priority, , High
SetBatchLines, -1

Exit

~*$RButton::
	KeyWait, RButton, T0.350
	If ErrorLevel
	{
		#MaxHotkeysPerInterval 20000
		#HotkeyInterval 20
		SetKeyDelay, -1, -1
		Loop
		{
			If !GetKeyState("RButton", "P")
				Break
			Send 4
			Sleep 80
		}
	}
	Return
If you press and hold RButton for just over a quarter of a second it'll spam 4 and stop when you release RButton. "~" allows RButton to act normally so a single click will not trigger the loop.

Return to “Gaming”

Who is online

Users browsing this forum: Hman and 15 guests