Clean up key release order of Alt+Tab

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
cfm
Posts: 1
Joined: 17 Apr 2024, 09:50

Clean up key release order of Alt+Tab

17 Apr 2024, 10:32

When switching tasks with Alt+Tab in windows. How can I make sure tab is released before alt?

My issue is that I often release both Alt and Tab virtually at the same time and I might end up with a Tab-release sendt to the target window. This results in the focus shifting away from where I left it.

I have tried both supressing Alt-up and taking over Alt-Tab altogether, but I can't find a way to clean up the order of key releases. The best I've been able to do is make it beep at me every time I release Alt before Tab. :eh:

Code: Select all

~*LAlt Up::
{
    if(GetKeyState("Tab", "P")){
        ; SendPlay("{Tab Up}")
        SoundBeep(1760, 100) ; A6
    }
}
(currently using both v1.1 and v2)
User avatar
rommmcek
Posts: 1478
Joined: 15 Aug 2014, 15:18

Re: Clean up key release order of Alt+Tab

25 Apr 2024, 21:02

Try:

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force

~*LAlt Up:: {
    Hotkey "Tab", TabBlock
    SetTimer TabOff, -2000 ; for testing a large value, adjust as needed...
}

TabBlock(*) {
    Return
}

TabOff() {
    Hotkey "Tab", "Off"
}

Esc:: ExitApp ; for safely testing...

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: lilacle, vmech and 29 guests