AHK and Putty, custom modifier key

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
joscherrer
Posts: 1
Joined: 17 Feb 2018, 07:40

AHK and Putty, custom modifier key

24 Feb 2018, 16:16

I have two 60% keyboard and have to press the function key to use several keys like Left Right Up Down or the F1-F12 keys.

On one of my keyboard there is a physical switch that lets me change the capslock key to a function key (because capslock is a pretty useless key let's be honest) and I got used to this function.
My second keyboard doesn't have this option, so I use AHK to simulate this behaviour :

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetCapsLockState, AlwaysOff

CapsLock & Backspace::
    Send, {Del}
Return
CapsLock & i::
    Send, {Up}
Return
CapsLock & j::
    Send, {Left}
Return
CapsLock & k::
    Send, {Down}
Return
CapsLock & l::
    Send, {Right}
Return

CapsLock & h::
    Send, {Home}
Return
CapsLock & n::
    Send, {End}
Return

CapsLock & s::
    Send, {Volume_Down}
Return
CapsLock & d::
    Send, {Volume_Up}
Return
CapsLock & a::
    Send, {Volume_Mute}
Return

CapsLock & 1::
    Send, {F1}
Return
CapsLock & 2::
    Send, {F2}
Return
CapsLock & 3::
    Send, {F3}
Return
CapsLock & 4::
    GetKeyState, state, Alt
    if state = D
        SendInput !{F4}
    else
        SendInput {F4}
    Return
Return
CapsLock & 5::
    Send, {F5}
Return
CapsLock & 6::
    Send, {F6}
Return
CapsLock & 7::
    Send, {F7}
Return
CapsLock & 8::
    Send, {F8}
Return
CapsLock & 9::
    Send, {F9}
Return
CapsLock & 0::
    Send, {F10}
Return
CapsLock & -::
    Send, {F11}
Return
CapsLock & =::
    Send, {F12}
Return
The scripts works pretty well (sometimes I just have to restart it because the capslock key gets stuck on the ON state, I don't know why)

But I've encountered a problem. When I use PuTTY, it's like the PuTTY terminal captures the keystrokes before AHK.
For example when I press CapsLock + J, it write "J" in the terminal instead of sending {Left}
Is there a way to force AHK to capture all the keystrokes before any application ?

Thanks for your help !

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Google [Bot], mikeyww and 198 guests