Remap Spacebar key to Right Alt key

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
taneal1
Posts: 4
Joined: 01 Feb 2017, 12:15

Remap Spacebar key to Right Alt key

Post by taneal1 » 01 Feb 2017, 12:28

Hi,

The Spacebar on my wife's Samsung laptop works only with a HARD thump, and has defied all attempts to fix it. I'd like to remap the Right Alt key to function as the Spacebar. Simplest thing in the world, but I can't get it to work...

I can remap for example the "a" key to produce the letter "b", so the program is working.

I had a difficult time finding the proper names for the Spacebar and Alt keys, and the syntax I've tried is as follows:

Space::RAlt
Space::Alt
space::alt

The Alt key still functions as the Alt key in all instances.

Thanks for any assistance...

Tom

User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Remap Spacebar key to Right Alt key

Post by Nextron » 01 Feb 2017, 12:31

Input::Output so you're making the spacebar into alt.

RAlt::Space is what you need.

taneal1
Posts: 4
Joined: 01 Feb 2017, 12:15

Re: Remap Spacebar key to Right Alt key

Post by taneal1 » 01 Feb 2017, 23:53

Thanks Nextron,

I came back to report that I had figured that out by using different keys, but it still doesn't work. The RAlt key still functions as an Alt key rather than as the Spacebar.

The Registry script below successfully remaps my RAlt key to function as the Spacebar on my Win 7 Desktop so the scan codes are correct. But on the Win 10 Laptop with the bad Spacebar key, the RAlt key remains an Alt key. I don't know why it would matter that it uses Win 10, so I suspect something about the Samsung Laptop keyboard is preventing it from working.

FWIW, Sharpkeys does not detect any keyboard press on the Win 7 Desktop or Win 10 Laptop when the LAlt or RAlt key is pressed.

REGISTRY SCRIPT:
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,39,00,38,e0,00,00,00,00

Any help is GREATLY appreciated!

Tom

4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
Contact:

Re: Remap Spacebar key to Right Alt key

Post by 4GForce » 02 Feb 2017, 00:09

Start your script
Double-click the icon in the taskbar
Menu > View > Key history and script info
Type the key you're trying to handle then hit F5 to refresh

Use either the key in the key column or the sc code like so

Code: Select all

sc01E::sc01F          ; this binds a to s ( at least for me )

Edit : oh you might need this in your script for the key history tool to work ->

Code: Select all

#InstallKeybdHook

User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Remap Spacebar key to Right Alt key

Post by Nextron » 02 Feb 2017, 01:28

Perhaps on your Win10 laptop the keyboard is configured that RAlt is AltGr, which actually mimics LCtrl+RAlt. So try <^RAlt::Send {Space}.

taneal1
Posts: 4
Joined: 01 Feb 2017, 12:15

Re: Remap Spacebar key to Right Alt key

Post by taneal1 » 02 Feb 2017, 15:32

Nextron wrote:Perhaps on your Win10 laptop the keyboard is configured that RAlt is AltGr, which actually mimics LCtrl+RAlt. So try <^RAlt::Send {Space}.
Thank you for the help, Nextron, but the Right-Alt key continues to function as an Alt key.

Tom

taneal1
Posts: 4
Joined: 01 Feb 2017, 12:15

Re: Remap Spacebar key to Right Alt key

Post by taneal1 » 02 Feb 2017, 23:15

Edit : oh you might need this in your script for the key history tool to work ->

Code: Select all

#InstallKeybdHook
[/quote]

Thanks 4GForce,

I used the following code:
RAlt::Space
and it did NOT work. The Rt Alt key remained an Alt key and did not send a space scan code.

To start the analysis I added #InstallKeybdHook into the script as you suggested. The Key history showed a space when I pressed the Rt Alt key. I opened Notepad and the R Alt key generated a 'space'!

I don't understand why it now works :crazy: , but I'm not going to mess with it further...

Thanks to ALL who responded.

Tom

videoman
Posts: 1
Joined: 23 Sep 2020, 06:32

Re: Remap Spacebar key to Right Alt key

Post by videoman » 23 Sep 2020, 06:35

Is there any chance you can post teh full reg code please?
I have the exact same issue

Samuelinca
Posts: 1
Joined: 20 Jan 2022, 17:09

Re: Remap Spacebar key to Right Alt key

Post by Samuelinca » 20 Jan 2022, 17:16

Late reply, but this ended up working for me while trying to map my Left Alt to the x button:

LAlt::Send, x

Hope this helps someone

Post Reply

Return to “Ask for Help (v1)”