Mapping WASD for text editing

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
HenriL

Mapping WASD for text editing

18 Aug 2018, 18:10

Hi,

I'd like to map RAlt + WASD keys as arrow keys for use in text editing. My current try is following:

Code: Select all

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

*>!w::Send {RAlt Up}{Up}
*>!a::Send {RAlt Up}{Left}
*>!s::Send {RAlt Up}{Down}
*>!d::Send {RAlt Up}{Right}
This works almost correctly, but what I cannot understand is that the keys work with Ctrl held down but not with Shift. Specifically, for example Ctrl+RAlt+D skips words to the right like Ctrl+Right does, but Shift+RAlt+D does not select text like Shift+Right does, but just moves right. Can anybody explain what is going on?

Henri
Rohwedder
Posts: 7622
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Mapping WASD for text editing

19 Aug 2018, 03:25

Hallo,
you need Send {Blind} but this seems to disable the masking of RAlt.
Try these Remappings:

Code: Select all

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
*RAlt::Return
#If GetKeyState("RAlt","P")
w::Up
a::Left
s::Down
d::Right
#If
but you lose the RAlt's native function.
Rohwedder
Posts: 7622
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Mapping WASD for text editing

20 Aug 2018, 10:54

Hallo,
I've come up with another way:

Code: Select all

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

*>!w::
SetKeyDelay -1
Send,{Blind}{RAlt up}{Up DownR}{RAlt Down}
Return
*>!w up::
SetKeyDelay -1
Send,{Blind}{Up up}
Return
*>!a::
SetKeyDelay -1
Send,{Blind}{RAlt up}{Left DownR}{RAlt Down}
Return
*>!a up::
SetKeyDelay -1
Send,{Blind}{Left up}
Return
*>!s::
SetKeyDelay -1
Send,{Blind}{RAlt up}{Down DownR}{RAlt Down}
Return
*>!s up::
SetKeyDelay -1
Send,{Blind}{Down up}
Return
*>!d::
SetKeyDelay -1
Send,{Blind}{RAlt up}{Right DownR}{RAlt Down}
Return
*>!d up::
SetKeyDelay -1
Send,{Blind}{Right up}
Return
not fully tested because I have AltGr instead of Ralt
HenriL

Re: Mapping WASD for text editing

20 Aug 2018, 18:59

Thanks for the help, works like a charm!

Only tried the first method yet, which does indeed block it's original functionality. I actually have an AltGr as well, but I use US layout for coding so no real use for it. The second would seem to fix that as well. However Ctrl+Alt seems to be about the same thing as AltGr, so with the first method it can be used to type special characters like €.

For anyone who likes to optimize their typing and programmers especially, I strongly suggest this mapping. Also map q/e as Home/End and r/f as PgUp/PgDown, and no need to move palms ever again :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 333 guests