Page 1 of 1

Spaming a key without losing Ctrl, Alt and Caps modifiers

Posted: 20 Oct 2019, 06:21
by Gael4
Hello everyone !

I recently discovered autohotkey and it helps me play wow without developing arthritis, however there is a big issue with every script I have tried that spams a key with a toggle :
it prevents me from using modifiers. In a game like wow where half of my key binds use modifiers it can be a death sentence ! Is there a way around it ? I can use regular keybinds just fine while the script is active, just not the aforementioned.

Here are the scripts I tried :

1st try :

Code: Select all

~<::
loop
{
  GetKeyState, NumLockState, NumLock, T

  if (NumLockState = "U") {
	break
  }     else {
	Send <
	Sleep, 10 ; Sleep for 20 msec
	GetKeyState, state, 5, P
	if state = U ; The key has been released, so break out of the loop.
	 break
  }
}
return

2nd try :

Code: Select all

<::
If State=20
State=Off
else
State=20
SetTimer SendKey, %State%
Return

SendKey:
Send <
Return

3rd try :

Code: Select all

OneToggle=0
#IfWinActive World of Warcraft
; to force the hotkey only to Wow
<::
if (OneToggle := !OneToggle)
SetTimer, timer, -1
return
#ifWinActive
; to end the WoW key binding
timer:
While (OneToggle)
{ Send <
sleep 100
}
Return
[Mod edit: [code][/code] tags added]


I am very bad at scripting so I just copied those scripts and changed the key.

Thanks in advance !

Re: Spaming a key without losing Ctrl, Alt and Caps modifiers

Posted: 30 Nov 2019, 15:16
by Gael4
Up nobody had the same problem ? :)

Re: Spaming a key without losing Ctrl, Alt and Caps modifiers

Posted: 30 Nov 2019, 17:11
by Xtra
If you want to have those hotkeys and expect them to work with any modifiers held down you need to use the hotkey prefix *

Code: Select all

~*<::
HTH