0
votes

In AutoHotKey, I am having trouble. I need this to work:

$Alt & w::Send ^w

I feel like this should be super simple, but it fails no matter how I try to rejigger the shortcut/hotkey side of the code (e.g. {$Alt}, ${Alt}, etc).

Note 1: I am unable to simply use "!w::Send ^w" because the "alt" keypress will trigger the program (menu?) such that it closes the entire thing, and not just the active window. So I need the $ over there.

Note 2: "$Alt" by itself works just fine, but in combo with the "w" key, it fails.

1

1 Answers

1
votes
#UseHook       ; Does the same thing as '$'
SendMode Input
!w::Send ^w    ; Don't use '&' with modifier keys like you did.

If Alt bothers you maybe this will help:

; Asterisks: fire hotkeys even if extra modifiers are being held down.
*LAlt::return          ; Nothing happens when you press 'LAlt'.
*LAlt Up::             ; On release it checks if the prior key was 'w'.
If (A_PriorKey == "w") 
    Send ^w            ; If so, sends Control + W.
else Send {LAlt}       ; If not, sends LAlt.
return