0
votes

I'm trying to use AutoHotKey to emulate my KBC Poker keyboard on the notebook keyboard, I want use the RWin key as function key, so for example, RWin + a would be left, RWin + w would be up, etc. I have this script configured in AHK:

RWin & w::Send {Up}
RWin & a::Send {Left}
RWin & s::Send {Down}
RWin & d::Send {Right}

It works in the sense that I can use RWin + w/a/s/d to move the cursor around, however what does not work is to press Shift + RWin + d to select text.

Another example is the F4 key, my mapping:

RWin & 4::Send {F4}

So I would expect Alt + RWin + 4 to close the current window (Alt + F4 behavior), but it doesn't.

I want to somehow enable the modifier keys to work with my hot keys without specifying each and every possible combination. How can I do that?

1
Put an asterisk in front of each hotkey: *RWin & 4::. The other requirement (with ALT + F4) is rather inconsistent. How do you expect a hotkey like Alt + RWin + 4 to "ignore" the RWin + 4, but let the Alt trickle through? You can either have all hotkeys sent with ~ or none. - MCL
That syntax gives me an error. Example: *RWin & d::Send {Right}, Error: Invalid hotkey. - Alexander Rechsteiner
I suggest this little "hack" then: click. - MCL
I tried this script, but the result is the same: The cursor does move, so {Right} is triggered, but the text is not selected, so Shift is ignored. - Alexander Rechsteiner
Again, please refer to my first comment. You'll have to do some extra coding if you want to let the extra modifier "trickle through". I only wanted to show you how you can get extra modifiers to trigger hotkeys in the first place. - MCL

1 Answers

0
votes

I know this doesn't necessarily answer your question, but I thought it may help you out a bit. It is basically an elaborate example of MCL's link above.

I use a function that enables me to use CapsLock as a cursor movement modifier. It works for the very basics of moving the cursor but also allows for a modifier to be executed and Alt to be used for text highlighting. Hope this helps!

; Simple Movement
CapsLock & h::CapsNav("Left")
CapsLock & j::CapsNav("Down")
CapsLock & k::CapsNav("Up")
CapsLock & l::CapsNav("Right")

; Start of line or End of line
CapsLock & n::CapsNav("Home")
CapsLock & p::CapsNav("End")

; Word jump
CapsLock & .::CapsNav("Right", "!")
CapsLock & m::CapsNav("Left", "!")

CapsNav(action, initmod = "", mod = "+")
{
    If ! GetKeyState("alt")
        Send % initmod "{" action "}"
    Else
        Send % mod . initmod "{" action "}"
    SetCapsLockState, AlwaysOff
}