Hit one key to hold a second key down, until third is pressed

Posted by Core Xii on Super User See other posts from Super User or by Core Xii
Published on 2012-11-10T00:48:59Z Indexed on 2012/11/16 17:03 UTC
Read the original article Hit count: 174

Filed under:

I'm trying to get the following behavior with AutoHotKey: When the A key is pressed, AHK holds down the S key until the D key is pressed. The following script isn't working as expected:

a::
    Send {s Down}
    return

d::
    if (GetKeyState("s", "P"))
        {
        Send {s Up}
        }
    return

Neither is the following:

a::
    release_s = 0
    Loop
        {
        SendInput, s
        if release_s
            break
        }
    return

d::
    release_s = 1
    return

© Super User or respective owner

Related posts about autohotkey