Hold Key> Keypresses

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Kades
Posts: 2
Joined: 18 Feb 2018, 21:57

Hold Key> Keypresses

18 Feb 2018, 22:01

XButton2::
lbutton_count++
If (lbutton_count = 1)
{
Send {3}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)
{
Send {4}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)w
{
lbutton_count := 0
}
return



So basically I'm using M5 but I need to repeatedly hit m5 over and over to switch between weapons and kill someone.
I was wondering if there was a way to make it so I hold m5 button and it does it automatically instead of constant pressing
when I release m5 it goes back to normal, so a toggle in a way but not a proper toggle? xd
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Hold Key> Keypresses

18 Feb 2018, 22:52

You may want While GetKeyState("XButton2","P")
Kades
Posts: 2
Joined: 18 Feb 2018, 21:57

Re: Hold Key> Keypresses

18 Feb 2018, 23:04

While GetKeyState("XButton2","P")::
lbutton_count++
If (lbutton_count = 1)
{
Send {3}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)
{
Send {4}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)w
{
lbutton_count := 0
}
return


if I try

While GetKeyState("XButton2","P")
lbutton_count++
If (lbutton_count = 1)
{
Send {3}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)
{
Send {4}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)w
{
lbutton_count := 0
}
return

It doesn't open :()
I tried running it but I'm not familiar on what needs to be changed to work, thanks .

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: UncouthGoose and 119 guests