Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding to Ctrl-Shift in AutoHotKey

I want to use AutoHotKey to bind a command to Ctrl+Shift, in the same way that Windows detects it in order to change text direction from right-to-left to left-to-right. That is: I want it to be invoked when Ctrl+Shift is let go, and only if no keys were pressed between pressing Ctrl+Shift and letting them go.

I bound a hotkey on ^~ Shift Up and I expected it to behave the same way as when Windows binds to it for changing the text direction. But, I found that it gets invoked even in cases where I don't want it to be invoked.

For example, I could be selecting a few words by pressing Ctrl and Shift, and then using the arrow keys. Then I let go of Ctrl and Shift and the hotkey gets invoked. I don't want this. I want a hotkey that gets invoked only if I held nothing else then Ctrl and Shift. If I use any other keys, I want the hotkey not to be invoked.

Is there a way to do this with AHK?

like image 520
Ram Rachum Avatar asked Feb 13 '26 08:02

Ram Rachum


1 Answers

#InstallKeybdHook

Hotkey, ^LShift Up, ControlShiftUp
Return

ControlShiftUp:
    if (A_PriorKey != "LShift") ; [v1.1.01+]
        return
    ; do something
    msgbox hi
Return
like image 51
Teno Avatar answered Feb 15 '26 02:02

Teno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!