Page 1 of 1

AHK Help please

Posted: 09 Dec 2017, 15:54
by Hunterwor
I have written a script to have key number one spam and still be able to use modifiers but i want to be able to push number 1 and it start and push again to stop can some1 help me please also needs to run at 130 ms

This is what i have so far
#ifWinActive World of Warcraft
{
$1::
$^1::
$+1::
$!1::
Loop
{
if not GetKeyState("1", "P")
break
if GetKeyState("LCtrl", "P")
Send ^1
else if GetKeyState("LShift", "P")
Send +1
else if GetKeyState("LAlt", "P")
Send !1
else
Send 1
sleep 135
}
return
}

Re: AHK Help please

Posted: 10 Dec 2017, 02:32
by Rohwedder
Hallo,
see https://autohotkey.com/docs/commands/Send.htm#blind
and try:

Code: Select all

*1:: ;On/Off with key 1
	1active := !1active
	If 1active
		SetTimer 1, 130
	Else
		SetTimer 1, Off
Return
1:
    Send, {blind}1
Return
or shorter with Ternary operator https://autohotkey.com/docs/Variables.htm#ternary:

Code: Select all

*1::SetTimer 1,% 1active:=1active="130"?"Off":"130"
1:
    Send, {blind}1
Return