user1636617
user1636617

Reputation: 11

AutoHotkey: While 2 keys are pressed = press 3rd key?

In AutoHotkey, how can I do the following:

While SPACE and "either or a combination of [A, S, D, W]" are pressed down at the same time, send key LSHIFT every X milliseconds; do this until SPACE and and A, S, D, W are not pressed.

I'm a beginner. I tried multiple ways, but it didn't work at all.

Any help would be much appreciated!

I tried this, it does nothing:

q::

Loop
{
    If GetKeyState("Space", "P") && GetKeyState("w", "P")
    {
        Send, {LShift}
        Sleep, 500

        If Not GetKeyState("Space", "P") && GetKeyState("w", "P")
        {
            Pause
        }
    } 
}

Upvotes: 1

Views: 5262

Answers (1)

Avi
Avi

Reputation: 1381

Try this

x := 500 ;your x

~Space::
sleep, 500  ;this is extra time given to you and not X . Dont Edit.
loop,
{
if GetKeyState("W","p") or GetKeyState("A","p") or GetKeyState("S","p") or GetKeyState("D","p")
    Send, {LShift}
else
    break
sleep, x
}
return

Enjoy

Upvotes: 2

Related Questions