Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I simulate the Windows Key in Autohotkey

Tags:

autohotkey

I have an old IBM Model M from 1994. It's awesome, but it doesn't have a Windows key. I'd like to use AutoHotkey to map the combination of Ctrl + Alt to simulate the Windows key in order to take advantage of the default Windows shortcuts. Here's what I have:

LCtrl & LAlt :: Send {LWin}

It was suggested that maybe windows is overriding the Ctrl + Alt combo, so I also tried:

~Alt & Space :: Send {LWin}

Neither of these work. I'd at least like to be able to open the Start Menu from the keyboard (Ctrl + Esc is too awkward.)

like image 258
jtmcn Avatar asked Jun 08 '11 17:06

jtmcn


People also ask

What is Windows key in AutoHotkey?

Re: Using the windows key in a macro It is Win+Ctrl+Alt+Shift. In this case, because AutoHotkey is handling F10, the system ignores it. With your script, Send automatically "releases" Ctrl, Alt and Shift temporarily, but it does so after "pressing" LWin, so they are all momentarily pressed in combination.

How do I hit a Windows key?

The Windows key has the Microsoft logo on it and is found between the left Ctrl and Alt keys on the keyboard. Pressing the Windows key by itself opens the Start menu that also displays the search box. Holding down the Windows key and pressing another key, to trigger a keyboard shortcut, can speed up common tasks.


2 Answers

It seems the windows key is not working as long as either ctrl or alt is pressed. The following script works for me:

<^LAlt::
KeyWait Alt
KeyWait Ctrl
Send {RWin}
return

<!LCtrl::
KeyWait Alt
KeyWait Ctrl
Send {RWin}
return

You can press the left Ctrl and left alt in any order, and when you release both, the windows key is generated. This way you will not be able to send combination like Windows-E. If you want that too, you can do something like:

<^<!e::
KeyWait Alt
KeyWait Ctrl
Send {RWin down}e{RWin up}
return

<^<!space::
KeyWait Alt
KeyWait Ctrl
Send {RWin}
return

Now press leftctrl-leftalt-e to genereate windows-e, and press leftctrl-leftalt-space for just the windows key.

like image 88
wimh Avatar answered Sep 25 '22 13:09

wimh


I'm also using an IBM Model M. I've mapped RCtrl to the RWin key using KeyTweak (in Windows 7 and XP).

You can get KeyTweak here: KeyTweak homepage

(you can edit directly your registry but it's much easier to use the above program).

With this approach you can continue to use Win+R, Win+Tab (in Windows 7), Win+E, etc. and your Autohotkey scripts will also detect your RCtrl keypresses as RWin.

like image 23
Andre Albuquerque Avatar answered Sep 21 '22 13:09

Andre Albuquerque