I was trying to make a W key toggle, and no matter what I do I can't seem to get it to behave correctly.
Code: Select all
w::
{
static toggle := 0
Send("{Blind}{w " (toggle := !toggle) ? "down" : "up" "}")
}
I tried (with and without
{Blind}) all of the following
w,
W,
ASC 119
And, based on key history,
https://www.autohotkey.com/docs/v2/lib/KeyHistory.htm vk57,
sc011,
vk57sc011
The closest I could get is
{W down} would send a capital
W, but doesn't hold the key down, and
ASC 119 sends a lowercase
w but again does not hold it down.
Ideally I'd like this toggle to not affect other keys that are being held down (e.g. if
A or
LShift etc. are being held down (or not) keep them that way, if other keys are subsequently pressed/released, keep W in whatever state was set). Any idea how to go about this?