benichka
benichka

Reputation: 925

Autohotkey: binding win key

I've got a keyboard without the Win key (a legendary Model M!), so I want to bind it to ctrl + esc.

I tried those things, but that doesn't work -_-

LCtrl & Escape::LWin

or

LCtrl & Escape::
Send {LWin}
return

If I simply do:

Escape::LWin

or

Escape::
Send {LWin}
return

It's OK...

I also got another function that works OK like this:

^!F2::Send {Volume_Up 100}

So right now, can't figure what's wrong... Probably the misuse with the "&"?

Any idea?

Thank you!


After answer 1: I found this solution if I want to use the win key for combination (Win + e, Win + d, etc.):

^Esc::
KeyWait Ctrl        ;wait until Ctrl is up
 Send {LWin Down}   ;send left Windows key down
 sleep, 500
 Send {LWin Up}     ;send left Windows key up
Return

That way, when I depress ctrl, I've got 500ms to type the 2nd key.

Upvotes: 1

Views: 1580

Answers (1)

miroxlav
miroxlav

Reputation: 12194

The problem is that you if you press Ctrl+Esc, then LWin is sent by AHK, but you are still holding down Ctrl so the result of this 'cooperation' is Ctrl+LWin which is ignored by Windows.

Solution:

^Esc::
 KeyWait Ctrl    ;wait until Ctrl is up
 Send {LWin}     ;send left Windows key
Return

Upvotes: 4

Related Questions