Remapping CTRL + h as backspace Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
huberoliver
Posts: 5
Joined: 22 May 2019, 02:42

Remapping CTRL + h as backspace

22 May 2019, 02:58

I have remapped Capslock as CTRL. I am also trying to use CTRL + h as backspace, i.e., deleting the first token left to the current cursor position:

Capslock::Ctrl

^h::
send {BS}
return

Using the actual CTRL keys in combination with the h key does the job: If I hold the CTRL key and press the key, one token gets deleted to the left. The same is true for pressing and holding Capslock and the h key. HOWEVER: Trying to delete more than one token to the left is easy with the actual CTRL key: I simply keep the CTRL key pressed and press the h key as many times as tokens I want to delete. This does not work with the remapped Capslock key though. In this key, I have to release the Capslock key each time I want to use the h key to delete I token. If I do not do that (i.e., if I just keep the Capslock key pressed), the letter "h" gets printed to the screen.

Any chance I could make the remapping of the Capslock key "persistent"?
User avatar
elModo7
Posts: 190
Joined: 01 Sep 2017, 02:38
GitHub: elModo7
Location: Spain
Contact:

Re: Remapping CTRL + h as backspace

22 May 2019, 03:50

Try this:

Code: Select all

:X:^h::DoBackSpace()

DoBackSpace(){
    while(GetKeyState("LControl","H"))
    {
        Send {BS}
        Sleep 50
    }
}
:beer:
huberoliver
Posts: 5
Joined: 22 May 2019, 02:42

Re: Remapping CTRL + h as backspace

22 May 2019, 05:31

This did unfortunately not solve the issue. Using your code, pressing Capslock and H does not have any effect anymore.
Sam_
Posts: 125
Joined: 20 Mar 2014, 20:24

Re: Remapping CTRL + h as backspace  Topic is solved

22 May 2019, 16:09

huberoliver wrote:
22 May 2019, 02:58
I have remapped Capslock as CTRL. I am also trying to use CTRL + h as backspace, i.e., deleting the first token left to the current cursor position:

Capslock::Ctrl

^h::
send {BS}
return

Using the actual CTRL keys in combination with the h key does the job: If I hold the CTRL key and press the key, one token gets deleted to the left. The same is true for pressing and holding Capslock and the h key. HOWEVER: Trying to delete more than one token to the left is easy with the actual CTRL key: I simply keep the CTRL key pressed and press the h key as many times as tokens I want to delete. This does not work with the remapped Capslock key though. In this key, I have to release the Capslock key each time I want to use the h key to delete I token. If I do not do that (i.e., if I just keep the Capslock key pressed), the letter "h" gets printed to the screen.

Any chance I could make the remapping of the Capslock key "persistent"?
I was unable to reproduce your results. I tried your code as well as

Code: Select all

Capslock::LCtrl
^h::Send,{Backspace}
and

Code: Select all

#InstallKeybdHook
Capslock::LCtrl
^h::Send,{Backspace}
Both seem to be working as you want. Maybe make sure you are using the latest version of AHK. There have been a few bug fixes concerning hotkeys and hotstrings in the near past.
huberoliver
Posts: 5
Joined: 22 May 2019, 02:42

Re: Remapping CTRL + h as backspace

23 May 2019, 01:36

Bugger - the upgrade from 1.0x to the latest version solved the issue. Should have done that before wasting everybody's time. Thx for your support!
ranched
Posts: 1
Joined: 08 Jan 2021, 03:41

Re: Remapping CTRL + h as backspace

08 Jan 2021, 03:53

Sorry to revive an old thread but this is exactly what I was trying to accomplish and had to use another method. Posting here for others to find as well.
In my case ahk is installed on a remote session and I had to use the following to get it to work:

Code: Select all

; ctrl h as backspace 
^h::
KeyWait, Backspace
SendEvent {Backspace}
return
One more way to get that readline functionality everywhere.

Return to “Ask For Help”

Who is online

Users browsing this forum: malcev, Rohwedder, ZeroCSS and 40 guests