0

I am trying to trigger Alt tab Widget with SPACE + A but while holding down SPACE key, A and D need to act as directional keys. and lastly exit the Widget when SPACE is released.

The problem I am having is that when I release the SPACE key the widget does not disapear (alt remains stuck down)

I know I can invoke the sticky app switcher but this is more of an excersise to understand if/while GetKeyState, so please dont just reccomend alt+ctrl+tab

Thanks,

Here is my code.

Space & a::

Send,{Alt Down}
Send,{Tab}
Sleep, 200
While GetKeyState("Space", "P")

{
    a::Left 
    d::Right
}

If !GetKeyState("Space", "P")

{
    Send,{Alt Up}
}
1
Space & a::
    Send,{Alt Down}{Tab}
    ; Sleep, 200
Return

#If GetKeyState("Space", "P")

    a::Left 
    d::Right

    ; The tilde prefix (~) prevents AHK from blocking the key-down/up events:
    ~Space up:: Send,{Alt Up}

#If

https://www.autohotkey.com/docs/Hotkeys.htm#Tilde

| improve this answer | |
  • Sweet! that did it. Thanks! you are my hero – ahk_user99 Jun 14 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.