Double Tap -> toggle key Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
anon

Double Tap -> toggle key  Topic is solved

20 Apr 2017, 13:01

What I'm trying to do is make it so that when I double tap and HOLD a key, then it functions as holding down another key. For example, when I tap 'w' once, it should act as a normal 'w' keypress, but when I double tap it and hold down on the second tap, it makes it so that I'm holding both the 'w' key and another key until I release 'w'. I tried this but seems to activate when I hold down the key as well, not just when I double tap it:

Code: Select all

lasttime = 0

~W::

If (a_tickCount-lasttime < 300)

{

Send, {LShift down}

KeyWait, W, U

Send, {LShift up}

Return

}

lasttime:=a_tickCount

Return
User avatar
TheDewd
Posts: 1513
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Double Tap -> toggle key

20 Apr 2017, 13:28

Try this:

Code: Select all

~W::
    If (A_PriorHotkey <> "~W") || (A_TimeSincePriorHotkey > 400) {
        KeyWait, W
    }

    While (GetKeyState("W", "P")) {
        Send, {LShift Down}
    }
    
    Send, {LShift Up}
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: drlvanb and 431 guests