Search code examples
autohotkey

%A_ThisHotkey% and foreign keyboard layout


h::
    send %A_ThisHotkey%
return

This code returns english "h" letter, even with foreign keyboard layout. How to solve this?


Solution

  • A_ThisHotkey:

    The most recently executed hotkey or non-auto-replace hotstring (blank if none), in this case h.

    h:: MsgBox, %A_ThisHotkey%
    

    A_ThisLabel:

    The name of the label (subroutine) that is currently executing (blank if none). Each double-colon hotkey also creates a label, unless it is a function hotkey.

    h:: MsgBox, %A_ThisLabel%
    

    You can use

    h:: send %A_ThisLabel%
    

    in this case.