Advertisement
numinous510

Umlaute.ahk

Feb 9th, 2023
1,141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 3.04 KB | Source Code | 0 0
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                   ;;
  3. ;; German Umlaute Convenience Script                 ;;
  4. ;; for Superior US English Keyboard Layouts          ;;
  5. ;;                                                   ;;
  6. ;; version 0.3 - 07/18/04                            ;;
  7. ;; ck <use www.autohotkey.com forum to contact me>   ;;
  8. ;;                                                   ;;
  9. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  10.  
  11. ;; Usage Instructions:
  12. ;; -------------------
  13. ;; Load Script into AutoHotKey (only verified to work with 1.0.15 and Windows XP)
  14. ;; a) Press any of the TRIGGERKEYS [u,U,a,A,o,O,s] in any application of your choice
  15. ;; b) Within DELAY seconds, press the UMLAUTKEY to morph it into [ü,Ü,ä,Ä,ö,Ö,ß]
  16.  
  17. ; after pressing a TRIGGERKEY, you have to wait DELAY seconds to press the UMLAUTKEY
  18. ; and make it appear normally (without triggering any Umlaut morphing)
  19. DELAY = 1.0 ; default = 1
  20. UMLAUTKEY = 1 ; default = 1
  21.  
  22. ^!u::Suspend  ; Ctrl+Alt+U
  23.  
  24. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  25. ;;; You shouldn't have to edit below this line
  26. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  27.  
  28. ;#NoTrayIcon
  29.  
  30. ; remember the latest activated Umlaut
  31. UMLAUT = x
  32.  
  33. $u::
  34. ; Above: Use the $ to force the hook to be used, which prevents an
  35. ; infinite loop since this subroutine itself sends Numpad0, which
  36. ; would otherwise result in a recursive call to itself.
  37. ; mirror self
  38. Send, u
  39. ; initialize current Umlaut
  40. UMLAUT = {U+00FC}
  41. Goto, WaitForUK
  42.  
  43. $+u::
  44. Send, U
  45. UMLAUT = {U+00DC}
  46. Goto, WaitForUK
  47.  
  48. $o::
  49. Send, o
  50. UMLAUT = {U+00F6}
  51. Goto, WaitForUK
  52.  
  53. $+o::
  54. Send, O
  55. UMLAUT = {U+00D6}
  56. Goto, WaitForUK
  57.  
  58. $a::
  59. Send, a
  60. UMLAUT = {U+00E4}
  61. Goto, WaitForUK
  62.  
  63. $+a::
  64. Send, A
  65. UMLAUT = {U+00C4}
  66. Goto, WaitForUK
  67.  
  68. $s::
  69. Send, s
  70. UMLAUT = {U+00DF}
  71. Goto, WaitForUK
  72.  
  73. ;Euro Symbol
  74. $+e::
  75. Send, E
  76. UMLAUT = {U+20AC}
  77. Goto, WaitForUK
  78.  
  79.  
  80. WaitForUK:
  81. ; disable this and every other TRIGGERKEY to speed things up
  82. Hotkey, $u, Off
  83. Hotkey, $+u, Off
  84. Hotkey, $o, Off
  85. Hotkey, $+o, Off
  86. Hotkey, $a, Off
  87. Hotkey, $+a, Off
  88. Hotkey, $s, Off
  89.  
  90. ; Most editors can handle the fastest speed (-1)
  91. SetKeyDelay, 0 ; 0 for reliability
  92.  
  93. ; repeat until EITHER the UMLAUTKEY was hit or any other key breaking the sequence (non TRIGGERKEY)
  94. Loop
  95. {
  96.     ; watch next input string (only wait for exactly one char, mirror input, ignore backspace and wait DELAY seconds)
  97.     Input, UserInput, V L1 B T%DELAY%
  98.     if UserInput = %UMLAUTKEY%
  99.     {
  100.         Send, {backspace 2}%UMLAUT%
  101.         break
  102.         }
  103.         else if UserInput = u
  104.         UMLAUT = ü
  105.     else if UserInput = o
  106.         UMLAUT = ö
  107.     else if UserInput = +o
  108.         UMLAUT = Ö
  109.     else if UserInput = a
  110.         UMLAUT = ä
  111.     else if UserInput = A
  112.         UMLAUT = Ä
  113.     else if UserInput = s
  114.         UMLAUT = ß
  115.     else
  116.         break
  117. }
  118.  
  119. ; re-enable all initial Umlaut TRIGGERKEYS
  120. Hotkey, $u, On
  121. Hotkey, $+u, On
  122. Hotkey, $o, On
  123. Hotkey, $+o, On
  124. Hotkey, $a, On
  125. Hotkey, $+a, On
  126. Hotkey, $s, On
  127.  
  128. ; finish this hotkey handling routine  
  129. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement