Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Yet another American keyboard remapper for German Umlauts


  • Please log in to reply
8 replies to this topic
Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
(We have now so many variations for the theme that we can start a competition: http://www.autohotke...opic.php?t=2383 http://www.autohotke...topic.php?t=540 http://www.autohotke...opic.php?t=2695… Try them and vote, which fits your needs the best. You can evaluate the scripts in categories, like: ease of use, speed of typing, length of code, ease of maintainability, configurability, comprehensibility, etc.

When writing text the 7 German diacritical letters ä, Ä, ü, Ü, ö, Ö and ß are much more frequent than the symbols [, {, ], {, \, | and =. The corresponding keys are close together in the main keyboard area. Still, these symbols are frequent enough, so we must make them easy to type. What can be sacrificed is the simplicity of typing double diacritical characters, like ää, because they almost never occur.

Accordingly, the AHK script below remaps the symbols to the German characters. Pressing them twice in succession outputs the original symbols. Pressing Esc between them or moving the insertion point away and back produces double diacritical letters. So far this technique seems to be the fastest in typing, but it is limited to only a few special characters. If you need more, use the post modifier ring approach http://www.autohotke...opic.php?t=2383.

[ → ä    [[ → [    [{Esc}[ → ää
{ → Ä    {{ → {    {{Esc}{ → ÄÄ
] → ö    ]] → ]    ]{Esc}] → öö
} → Ö    }} → }    }{Esc}} → ÖÖ
\ → ü    \\ → \    \{Esc}\ → üü
| → Ü    || → |    |{Esc}| → ÜÜ
= → ß    == → =    ={Esc}= → ßß

Umlauts = äÄöÖüÜß
Symbols = [{]}\|=
Loop 7                          ; init: Hotkeys, and Umlauts to be sent
{
   StringMid U, Umlauts, %A_Index%, 1
   StringMid S, Symbols, %A_Index%, 1
   Transform n, ASC, %S%
   k%n% := U
   Hotkey $%S%, Remap
}

Loop    ; lower priority process for non-hotkey keystrokes
{       ; Case sensitive, Ignore generated, 1 key Long, Modified keys go, Visible
   Input key, C I L1 M V
   key0 = %key%
}

Remap:
   StringRight key, A_ThisHotkey, 1
   IfEqual key0, %key%, {       ; repeated symbol
      Send {BS}
      Sendraw %key%
      key0 =
   }
   else {                       ; remapped key
      Transform n, ASC, %key%
      Send % k%n%
      key0 = %key%
   }
return
This might suffer from the same compatibility problems with some SW as described in http://www.autohotke...topic.php?t=540

If you change the insertion point immediately after a remapped symbol is inserted and at the new place you start with the same key (a very unlikely scenario), the script might try to replace the Umlaut with the original symbol. If it bothers you, append the following
#MaxHotkeysPerInterval 500 ; Needed for fast turning mouse wheel
~*BS::          ; restart if insertion point moves
~*Esc::
~*Tab::
~*Home::
~*End::
~*PgUp::
~*PgDn::
~*Up::
~*Down::
~*Left::
~*Right::
~*LButton::
~*RButton::
~*MButton::
~*WheelDown::
~*WheelUp::
~*Ctrl::        ; restart if modifiers are pressed
~*Alt::
~*LWin::
~*RWin::
   key0 =
return
If you most often write programs with German comments, you need the symbols more frequently than the Umlauts. In this case the opposite mapping is faster: double the symbols for the diacritics. It is straightforward to modify the script accordingly. In programs the pair of "==" is commonly used but not the pair "??", so it could be better to map ?→ ß, or whatever you like. It is enough to change the corresponding character in the Symbols variable.
Umlauts = äÄöÖüÜß
Symbols = [{]}\|?
Loop 7                          ; init: Hotkeys, and Umlauts to be sent
{
   StringMid U, Umlauts, %A_Index%, 1
   StringMid S, Symbols, %A_Index%, 1
   Transform n, ASC, %S%
   k%n% := U
   Hotkey $%S%, Remap
}

Loop    ; lower priority process for non-hotkey keystrokes
{       ; Case sensitive, Ignore generated, 1 key Long, Modified keys go, Visible
   Input key, C I L1 M V
   key0 = %key%
}

Remap:
   StringRight key, A_ThisHotkey, 1
   IfEqual key0, %key%, {       ; repeated symbol
      Send {BS}
      Transform n, ASC, %key%
      Send % k%n%
      key0 =
   }
   else {                       ; remapped key
      Sendraw %key%
      key0 = %key%
   }
return
Instead of checking if the insertion point moves, we can also add a timer, which cancels remapping a second after the last hotkey. In this case only fast key repetitions have effect. Simply add the line
IfGreater A_TimeSincePriorHotkey,1000, SetEnv,key0
as the first line of the Remap subroutine. This last one is my favorite, so I copy it here one more time
;
; AutoHotkey Version: 1.0.30+
; Language:  English
; Platform:  Win2000/XP
; Author:    Laszlo Hars <www.Hars.US>
;
; Script Function: Remap American keyboards for German Umlauts

Umlauts = äÄöÖüÜß
Symbols = [{]}\|?               ; change to your taste

SetFormat integer, d            ; decimal
SetKeyDelay -1                  ; no delay needed for the tested applications

Loop 7                          ; init: Hotkeys, 7 Umlauts to be sent
{
   StringMid U, Umlauts, %A_Index%, 1
   StringMid S, Symbols, %A_Index%, 1
   Transform n, ASC, %S%
   k%n% := U
   Hotkey $%S%, Remap
}

Loop    ; lower priority process for non-hotkey keystrokes
{       ; Case sensitive, Ignore generated, 1 key Long, Modified keys go, Visible
   Input key, C I L1 M V
   key0 = %key%
}

Remap:
   IfGreater A_TimeSincePriorHotkey,1000, SetEnv,key0
   StringRight key, A_ThisHotkey, 1
   IfEqual key0, %key%, {       ; repeated symbol
      Send {BS}
      Transform n, ASC, %key%
      Send % k%n%
      key0 =
   }
   else {                       ; remapped key
      Sendraw %key%
      key0 = %key%
   }
return
It does the following remapping with 1s delay:
[[ → ä    [{>1s}[ → [[
{{ → Ä    {{>1s}{ → {{
]] → ö    ]{>1s}] → ]]
}} → Ö    }{>1s}} → }}
\\ → ü    \{>1s}\ → \\
|| → Ü    |{>1s}| → ||
?? → ß    ?{>1s}? → ??


rsvelko
  • Members
  • 2 posts
  • Last active: Nov 06 2009 03:45 AM
  • Joined: 06 Nov 2009
I tried all 4-5 scripts I found on google and after all the frustration I wrote this 7 lines script :

; # is the Win key
#a:: Send {ASC 0228}
#o:: Send {ASC 0246}
#u:: Send {ASC 0252}
#s:: Send {ASC 0223}

#+a:: Send {ASC 0196}
#+o:: Send {ASC 0214}
#+u:: Send {ASC 0220}


I like simple things....

Works in Excel/Word, Google Docs, Gmail, Notepad++

PS. Sorry if my stupid script makes the complicated ones obsolete...

PS2. 10x to http://www.mknoedel...._ASCII-Code.htm for the ASCII codes...

qubodup
  • Members
  • 1 posts
  • Last active: Jan 15 2010 04:41 PM
  • Joined: 15 Jan 2010

; # is the Win key
#a:: Send {ASC 0228}
#o:: Send {ASC 0246}
#u:: Send {ASC 0252}
#s:: Send {ASC 0223}

#+a:: Send {ASC 0196}
#+o:: Send {ASC 0214}
#+u:: Send {ASC 0220}

Thank you for this easy/simple/clear/handy script. I will never have to press Alt+Shift all the time, oh joy!

derRaphael
  • Members
  • 872 posts
  • Last active: Mar 19 2013 04:42 PM
  • Joined: 23 Nov 2007
my 2 cent

... When writing text the 7 German diacritical letters ä, Ä, ü, Ü, ö, Ö and ß ...


Only the so-called Umlauts are true diacritical letters, the "ß" is a ligature. The diacritical letters are called this way, cuz the horizontal colons (double dots or trema) are also called diaeresis: part of marks which alter existing letters to stress their new pronounciation.

the "ß" on the other hand has a different history: in older german fonts it was literally spelled sz where the s was represented by a ligature "ſ" and a kind of blackletter z that looks similar to an "ʒ". so the original ligature looked like this "ſʒ" (mostly used in Antiqua style prints)

well, anyways here's another solution to this problem:
:c*:Y''::{ASC 0159}
:c*:A''::{ASC 0196}
:c*:E''::{ASC 0203}
:c*:I''::{ASC 0207}
:c*:O''::{ASC 0214}
:c*:U''::{ASC 0220}
:c*:a''::{ASC 0228}
:c*:e''::{ASC 0235}
:c*:i''::{ASC 0239}
:c*:o''::{ASC 0246}
:c*:u''::{ASC 0252}
:c*:y''::{ASC 0255}
:c*:sz::{ASC 0223}

simply type the desired letter followed by two single quotation marks and you have the sign with the diaeresis. type sz to get an ß.

greets
derRaphael

All scripts, unless otherwise noted, are hereby released under CC-BY

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
As I said, it depends on your typing habits. For me, Win+Key combinations are too slow, because I regularly use 5 computers with 5 different keyboards, all of which have the Windows key in different position, so I have to look down. It is slower than double hits. CapsLock+Key combinations work better, but at upper case you still have to press three keys in the same time, which I don't like.

DerRaphael's solution is practically the same as the one included in the post-modifier script: there not the single quote, but the semicolon is used. If you hit it twice, it modifies the last typed letter. Any key, which is rarely used twice in a row could be used as modifier. (In my script you also have a choice for double, triple... hits of the modifier for different results.)

There are advantages of the last version of the post-modifier script: you can have many-many special characters in logical groups (I often need Hungarian, Greek and German letters, technical symbols, bullets, etc.). If you overshoot, you can get back to an earlier char by just hitting the modifier further. If you want to modify an already typed letter in any position in the same or another window, you just position the cursor after it and press the modifier key, no need to delete/re-type.

Btw. I would hate if my name would come out as Laßlo. The "sz" pair comes up too frequently to remap it to the sharp German "s".

derRaphael
  • Members
  • 872 posts
  • Last active: Mar 19 2013 04:42 PM
  • Joined: 23 Nov 2007

Btw. I would hate if my name would come out as Laßlo. The "sz" pair comes up too frequently to remap it to the sharp German "s".


sorry i didnt want to deface your name. i just came up with the solution, because the "ß" letter is also named "eszett" which bases on its origins as written in my previous post.

greets
derRaphael

All scripts, unless otherwise noted, are hereby released under CC-BY

garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005
I think ß is really old, never used it, german as ss
don`t like Umlaut`s , removed all special characters in filenames, had problem while copying or play music
thank you for the history of ß
hungarian to reed seems easy, the combined consonants say how to read
( I think like that)
s shut
z Susanne (second s)
sz Susanne (first s)
zs jam or better french > je
c like german z
cs chutney
v white
ly yet ( german j )
gy dj

Tilman
  • Guests
  • Last active:
  • Joined: --

:c*:Y''::{ASC 0159}
:c*:A''::{ASC 0196}
:c*:E''::{ASC 0203}
:c*:I''::{ASC 0207}
:c*:O''::{ASC 0214}
:c*:U''::{ASC 0220}
:c*:a''::{ASC 0228}
:c*:e''::{ASC 0235}
:c*:i''::{ASC 0239}
:c*:o''::{ASC 0246}
:c*:u''::{ASC 0252}
:c*:y''::{ASC 0255}
:c*:sz::{ASC 0223}


When I do this, it gives me as output literally "{ASC 0228}" instead of "ä", for example, when I type a''. What's wrong?

Thanks for your help!

rinku*gt
  • Members
  • 9 posts
  • Last active: Jul 04 2011 09:37 AM
  • Joined: 09 Oct 2010

We have now so many variations for the theme that we can start a competition

I want in on the competition! Though my script isn't just for German, but over 50 different languages. If you like overkill, or just need to use special characters of various languages, take a look at http://www.autohotke...ic.php?p=393349
It now sends through Windows without using the clipboard or Alt Codes (but if the dll call fails, it will send the Alt Code instead).