1

I am trying to implement this algorithm, and rewrite Windows input change logic :

enter image description here

I tried this

LAlt::
While GetKeyState("LAlt", "P") {
    Input, key, L1, % "{LControl}{RControl}{LWin}{RWin}{AppsKey}{LShift}{RShift}"
                    . "{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}"
                    . "{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}"
                    . "{Del}{Ins}{BS}{CapsLock}{NumLock}{PrintScreen}{Pause}{Tab}"
    (key = "") && key := "{" StrReplace(ErrorLevel, "EndKey:") "}"
    if (key != "{LShift}") {
        Send {LAlt Down}%key%
        Continue
    }
    KeyWait, LShift
    if (A_PriorKey != "LShift") {
        Send, {LAlt Down}{LShift Down}%A_PriorKey%
        Continue
    }
    else MsgBox, YEAH
}
return

But it doesn't work well, there is something wacky about it. The first Send is locking Alt down even after I release it on my keyboard. And eventually the key strokes fail I have to push them twice.

How can I write this in a more robust way?

0

0

You must log in to answer this question.

Browse other questions tagged .