How to globally map AltGr key to Alt key?

Tomas Sedovic picture Tomas Sedovic · Oct 23, 2008 · Viewed 46.5k times · Source

I want my AltGr key to behave exactly like left Alt.
Usually, I do this kind of stuff with Autohotkey, but I'm open to different solutions.

I tried this:

LControl & RAlt::Alt

And Autohotkey displayed error about Alt not being recognized action.
Then I tried the following code:

LControl & RAlt::
  Send {Alt down}
  KeyWait LCtrl
  KeyWait Ralt
  Send {Alt up}
return

which sort of works - I'm able to use the AltGr key for accessing hotkeys, but it still behaves differently:
When I press and release the left Alt, the first menu item in the current program receives focus.
Pressing and releasing AltGr with this script does nothing.

Any ideas? Is this even possible with Autohotkey? (remapping right Ctrl and Shift to their left siblings was piece of cake)


Note: I tried switching Alt to LAlt in the code and it made no difference.

Answer

Tomas Sedovic picture Tomas Sedovic · Jan 20, 2009

Thank you all for answers. I was unable to solve this using AutoHotkey -- PhilLho's answer was close, but I really needed exatly the same behaviour as with left Alt key.

However, the registry thing actually worked as I needed.

Save this as AltGR_to_LeftAlt.reg file and run it:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,38,00,38,e0,00,00,00,00

Or, there is a GUI tool that does this for you -- it's called SharpKeys and works peachy:
SharpKeys in action

Oh, and don't forget to reboot or log off -- it won't work until then!