Remapping arrow keys for programming Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Worly
Posts: 3
Joined: 18 Aug 2019, 07:26

Remapping arrow keys for programming

18 Aug 2019, 07:37

Hello,

I am trying to remap arrow keys to RightAlt + W, A, S, D, and Home and End to RightAlt + Q, E. I was able to create this script, but later I noticed shift select wasn't working (holding shift while using arrow keys to select text).
Does anyone have any idea how to fix that?

Thank you for help in advance. :D

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

~RAlt & w::
	Send {Up}
	return

~RAlt & a::
	Send {Left}
	return

~RAlt & s::
	Send {Down}
	return

~RAlt & d::
	Send {Right}
	return

~RAlt & q::
	Send {Home}
	return

~RAlt & e::
	Send {End}
	return
User avatar
Sir Teddy the First
Posts: 94
Joined: 05 Aug 2019, 12:31
Contact:

Re: Remapping arrow keys for programming

18 Aug 2019, 10:06

If I understand you correctly, what you are trying to do is use your custom hotkeys for the arrow-keys in combination with the Shift-Key.
This is indeed not working and is probably part of this problem:
Documentation wrote: Combinations of three or more keys are not supported.
Shift + your Hotkey would be three keys, this is not supported.
:eh: :think:
Worly
Posts: 3
Joined: 18 Aug 2019, 07:26

Re: Remapping arrow keys for programming

18 Aug 2019, 13:04

Hmm I see, if I understand correct, combination of three or more keys are not supported in AutoHotkey, but are supported by Windows?

I didn't think three key combination in AutoHotkey would be necessary.

I don't understand why wouldn't Shift + Arrow keys work with this script if AutoHotkey remaps RAlt + WASD to arrow keys.
Does Windows still takes into account that RAlt is pressed and disables select feature? If so, is there any way to disable that?
Worly
Posts: 3
Joined: 18 Aug 2019, 07:26

Re: Remapping arrow keys for programming  Topic is solved

19 Aug 2019, 15:00

I found a solution here: https stackoverflow.com /a/51464484/7366619 Broken Link for safety

Thank you Sir Teddy the First for the help. :D

Here's the script

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

MoveCursor(key) {
    shift := GetKeyState("SHIFT","P")
    control := GetKeyState("CONTROL","P")
    controlShift := control && shift

    if controlShift {
        Send, ^+%key%
    }
    else if shift {
        Send, +%key%
    }
    else if control {
        Send, ^%key%
    }
    else {
        Send, %key%
    }
}

SC056 & w::MoveCursor("{UP}")

SC056 & a::MoveCursor("{LEFT}")

SC056 & s::MoveCursor("{DOWN}")

SC056 & d::MoveCursor("{RIGHT}")

SC056 & q::MoveCursor("{HOME}")

SC056 & e::MoveCursor("{END}")

:
User avatar
Sir Teddy the First
Posts: 94
Joined: 05 Aug 2019, 12:31
Contact:

Re: Remapping arrow keys for programming

20 Aug 2019, 00:37

Well, that's an interesting approach, I'm glad you got this solved. :D
:eh: :think:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Araphen, DataLife, Google [Bot], ShatterCoder and 288 guests