简体   繁体   中英

Use multi-modifier key combination in autohotkey to replace alt-tab

I'd like to use Ctrl + Alt + Win as a modifier, and then d , as a replacement for the Alt + Tab key combination to switch windows in Windows.

I've tried the following script:

#^! & d::AltTab

But that won't work ("Error: invalid hotkey"), presumably because only one modifier is supposed to be used, which is also how the examples in the documentation are constructed.

Is there a way to make this work n.netheless?

Many thanks.

Alt-Tab Hotkeys says

Each Alt-Tab hotkey must be either a single key or a combination of two keys, which is typically achieved via the ampersand symbol (&).

Custom Combinations says

Combinations of three or more keys are not supported.

Try this:

#^!d::
    AltTabMenu := true  ; assign the boolean value "true" or 1 to this variable
    Send {Alt Down}{Tab}
return

#If (AltTabMenu)       ; If this variable has the value "true"

    ~*Alt Up::         ; release the Alt Key to
        Send {Alt Up}  ; close the menu
        AltTabMenu := false ; Set the variable to false in preparation for the next press of the #^!d hotkey.
    return

#If

@user3419297's suggestion was not working for me:

AltTabMenu := false

#^!d::
    AltTabMenu := true
    Send, {Alt Down}{Tab}
return

#If (AltTabMenu)       
    ~*Alt Up::          
        Send, {Alt Up}  
        AltTabMenu := false 
    return

#If

...but this seemingly (to me at least) functionally identical code is working:

AltTabMenu := false

#If not (AltTabMenu)
    #^!d::
        AltTabMenu := true  
        Send, {Alt Down}{Tab}
    return

#If (AltTabMenu)        
    #^!d:: Send, {Alt Down}{Tab}
    ~*Alt Up::          
        Send, {Alt Up}  
        AltTabMenu := false
    return

#If

edit: I've added the shifted variant as well to select the previous window

AltTabMenu := false

#If not (AltTabMenu)
    #^!d::
        AltTabMenu := true  
        Send, {Alt Down}{Tab}
    return

#If (AltTabMenu)        
    #^+!d:: Send, {Alt Down}{Left}
    #^!d:: Send, {Alt Down}{Right}
    ~*Alt Up::          
        Send, {Alt Up}  
        AltTabMenu := false
    return

#If

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM