Assigning Arrow Key Functionality to Alt+[Key] in AutoHotkey Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AladdinMhemed
Posts: 13
Joined: 09 Jan 2019, 16:52

Assigning Arrow Key Functionality to Alt+[Key] in AutoHotkey

22 May 2023, 17:16

I am trying to map the functionality of arrow keys to `Alt+J`, `Alt+I`, `Alt+;`, and `Alt+K` using AutoHotkey. The idea is to enable cursor navigation within text without moving my hand from its resting position on the keyboard.

I am currently using the following script to achieve this:

Code: Select all

!j:: send {Left}
This script works to an extent. When I press `Alt+J`, it moves the cursor to the left, as expected. However, when I hold down `Alt+J` to move the cursor further to the left, it moves a little, but it also types `j` letters into the text.

I have tried several solutions suggested by OpenAI's ChatGPT-4 model, but none have resolved the issue.

Would appreciate any advice or solutions that could help me fix this issue.

Thank you in advance.

[Mod edit: Moved topic to AHK v1 help, based on posted code.]
Rohwedder
Posts: 7656
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Assigning Arrow Key Functionality to Alt+[Key] in AutoHotkey  Topic is solved

23 May 2023, 00:42

Hallo,
here it works, but try the following variants if they work as desired:

Code: Select all

<!j::send {Left} ;left Alt + J
or

Code: Select all

$!j::send {Left} ;Alt + J with keyboard hook
or

Code: Select all

$<!j::send {Left} ;left Alt + J with keyboard hook
AladdinMhemed
Posts: 13
Joined: 09 Jan 2019, 16:52

Re: Assigning Arrow Key Functionality to Alt+[Key] in AutoHotkey

24 May 2023, 09:09

Thank you @Rohwedder

Code: Select all

<!j::send {Left} ;left Alt + J 
works as expected,

What does `<` do?
also `$`?

Thanks
anogoya
Posts: 1
Joined: 19 Nov 2020, 11:16

Re: Assigning Arrow Key Functionality to Alt+[Key] in AutoHotkey

27 Mar 2024, 09:45

Hate to hijack a thread but I've been trying to get a combination to move one word over, and eventually to the end of the sentence or beginning.
I use neoVim and am so used to easy navigation that it causes great frustration when I'm in an editor that does not support vim-motions.
I came up with :

Code: Select all

CapsLock & v Up::Send "{Ctrl DownTemp}{Right}"
as a way of moving one word over when editing text files.
My problem is after I use it, it hijacks future keystrokes in some weird fashion which necessitates locking and unlocking my computer to get out off.

What am I missing?
TLDR; how can I use resting keyboard finger positions to move one word left or right?
User avatar
boiler
Posts: 16983
Joined: 21 Dec 2014, 02:44

Re: Assigning Arrow Key Functionality to Alt+[Key] in AutoHotkey

27 Mar 2024, 10:20

anogoya wrote: Hate to hijack a thread...
Please don't. If your question isn't directly related to the topic of an existing thread, and yours is only very loosely related, then start a new thread.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: GEOVAN, Google [Bot], mikeyww and 211 guests