'How to send tilde or backtick in AutoHotkey using a Nordic keyboard layout?

To bind AltGr+, to tilde ~ and AltGr+. to backtick ` I wrote this AutoHotkey script:

<^>!,:: Send, ~
<^>!.:: Send, ``

This works fine when using some keyboard layouts, for example the Italian one.

Some keyboard layouts, for example the Estonian and I believe other Nordic layouts as well, don't "fire" those symbols right away but require them to be pressed in combination with other keys. For example:

  • ~+SPACE produces ~
  • ~+o produces õ

With this kind of keyboard layouts the script I wrote requires the keys combination to be pressed twice and has the result of producing the symbols twice.

For example AltGr+,+, produces ~~

Is it possible to make the script work correctly, regardless of the keyboard layout used?



Solution 1:[1]

This should work on all keyboards that use AltGr:

<^>!,:: Send {text}~
<^>!.:: Send {text}`` ; backtick must be escaped by another one

See Text mode in the documentation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user3419297