Skip to content

Instantly share code, notes, and snippets.

@juzim
Created January 16, 2020 09:22
Show Gist options
  • Save juzim/e806a0d301eeed3c85e1d657a8d3c0a1 to your computer and use it in GitHub Desktop.
Save juzim/e806a0d301eeed3c85e1d657a8d3c0a1 to your computer and use it in GitHub Desktop.
#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.
CapsLock::
SetFormat, Integer, H
WinGet, WinID,, A
ThreadID:=DllCall("GetWindowThreadProcessId", "UInt", WinID, "UInt", 0)
InputLocaleID:=DllCall("GetKeyboardLayout", "UInt", ThreadID, "UInt")
Loop
{
Input , Key, L1 T0.1
if (InputLocaleID == "0xF0020409")
{
If (Key="s")
Send, ö
If (Key="-")
Send, ä
If (Key="/" or Key="u" or Key="g")
Send, ü
If (Key="o")
Send, ß
}
else
{
If (Key=";" or Key="o")
Send, ö
If (Key="'" or Key="a")
Send, ä
If (Key="[" or Key="u")
Send, ü
If (Key="s")
Send, ß
}
If !GetKeyState("Capslock","p")
Break
}
Return
Control::
SetFormat, Integer, H
WinGet, WinID,, A
ThreadID:=DllCall("GetWindowThreadProcessId", "UInt", WinID, "UInt", 0)
InputLocaleID:=DllCall("GetKeyboardLayout", "UInt", ThreadID, "UInt")
Loop
{
if (InputLocaleID == "0xF0020409")
{
^o::^s
^k::^v
^j::^c
^,::^w
^y::^t
^n::^l
^q::^x
}
If !GetKeyState("Control","p")
Break
}
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment