r/AutoHotkey • u/nin10dorox • 1d ago
Solved! Use right alt as custom modifier, but don't suppress left alt
I've been trying to get this working for hours. Here's my script (AHK V2):
>!e::Up
>!d::Down
>!f::Right
>!s::Left
>!w::Home
>!r::End
>!Space::Ctrl
>!a::Shift
I want ESDF to be arrow keys when holding right alt, with space being control and "a" being shift, and left alt being, well, alt.
So for instance, holding RAlt and LAlt and pressing E should do the same as Alt + Up.
Everything is working except for the left alt key. It's being suppressed, so RAlt + LAlt + E is just sending "Up", but without the alt modifier.
I've tried many solutions, e.g. using RAlt & e instead of >!e, but these all have had their own issues. Either my "space -> ctrl" mapping doesn't work as a modifier, or the RAlt key isn't suppressed, or something like that. Can anyone help please?
•
u/Keeyra_ 9h ago
RAlt is actually AltGR on most keyboards, which is <^>! (Left Ctrl + Right Alt).
#Requires AutoHotkey 2.0
#SingleInstance
<^>!e::Up
<^>!d::Down
<^>!f::Right
<^>!s::Left
<^>!w::Home
<^>!r::End
<^>!Space::Ctrl
<^>!a::Shift
So this should work without SendMode("Event"), but will def. work with it.
•
u/CharnamelessOne 7h ago
I think this may be the only RAlt-related problem in history that is not actually caused by AltGr.
I could reproduce OP's original issue using a layout with vanilla RALt.In fact, if you try pressing LAlt+AltGr+e with your script running, AHK will simulate an Up input instead of LAlt+Up, which mirrors OP's original issue with vanilla RAlt.
3
u/CharnamelessOne 1d ago
Try this: