Page 1 of 1

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

Posted: 22 May 2023, 17:16
by AladdinMhemed
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.]

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

Posted: 23 May 2023, 00:42
by Rohwedder
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

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

Posted: 24 May 2023, 09:09
by AladdinMhemed
Thank you @Rohwedder

Code: Select all

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

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

Thanks

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

Posted: 24 May 2023, 09:36
by Rohwedder

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

Posted: 27 Mar 2024, 09:45
by anogoya
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?

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

Posted: 27 Mar 2024, 10:20
by boiler
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.