Skip to content

Instantly share code, notes, and snippets.

@dnnsmnstrr
Created August 14, 2020 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnnsmnstrr/0591fd7d64eda2fc63d99e6f488a435a to your computer and use it in GitHub Desktop.
Save dnnsmnstrr/0591fd7d64eda2fc63d99e6f488a435a to your computer and use it in GitHub Desktop.
Enable umlaut replacement, with the option to revoke the replacement using backspace
; #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.
hscancel=backspace
hstime=1000
hsfrom =
hsto =
; UMLAUTE
:*?C:ae::
replace("ae","ä")
return
:*?C:Ae::
replace("Ae","Ä")
return
:*?C:oe::
replace("oe","ö")
return
:*?C:Oe::
replace("Oe","Ö")
return
:*?C:ue::
replace("ue","ü")
return
:*?C:Ue::
replace("Ue","Ü")
return
:*?C:Ss::
replace("Ss","ß")
return
; REPLACE
replace(from,to)
{
global hsfrom, hsto, hscancel, hstime
hsfrom = %from%
hsto = %to%
send %hsto%
hotkey, $%hscancel%, hscancel
hotkey, $%hscancel%, on
settimer, hsdisablecancel, -%hstime%
}
hscancel:
hslen := strlen(hsto)
send {bs %hslen%}%hsfrom%
; fall through
hsdisablecancel:
hotkey, %hscancel%, off
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment