Painless accented characters…

We’ve mentioned Autohotkey in a previous post (and probably will again, in the future). Today’s post has to do with using this marvelous utility to painlessly deal with accented characters.

I’ve worked on Windows machines with multiple keyboards installed and active, and in my opinion, if all you need one of the keyboards for is to type accented characters, you’re complicating your life.

Over the years, I’ve attempted various schemes to enter accented characters, and while some of them work most of the time, I hadn’t ever found a method that works all the time until I tried to implement the following set of hotstrings in Autohotkey.

; ACCENTED CHARACTERS
; * = ending char not required
; ? = trigger even if inside string
; c = case-sensitive

; GRAVE
:*c?:\AG\::{ASC 0192}
:*c?:\EG\::{ASC 0200}
:*c?:\IG\::{ASC 0204}
:*c?:\OG\::{ASC 0210}
:*c?:\UG\::{ASC 0217}
:*c?:\ag\::{ASC 0224}
:*c?:\eg\::{ASC 0232}
:*c?:\ig\::{ASC 0236}
:*c?:\og\::{ASC 0242}
:*c?:\ug\::{ASC 0249}

; ACUTE
:*c?:\AA\::{ASC 0193}
:*c?:\EA\::{ASC 0201}
:*c?:\IA\::{ASC 0205}
:*c?:\OA\::{ASC 0211}
:*c?:\UA\::{ASC 0218}
:*c?:\YA\::{ASC 0221}
:*c?:\aa\::{ASC 0225}
:*c?:\ea\::{ASC 0233}
:*c?:\ia\::{ASC 0237}
:*c?:\oa\::{ASC 0243}
:*c?:\ua\::{ASC 0250}
:*c?:\ya\::{ASC 0253}

; CIRC
:*c?:\AC\::{ASC 0194}
:*c?:\EC\::{ASC 0202}
:*c?:\IC\::{ASC 0206}
:*c?:\OC\::{ASC 0212}
:*c?:\UC\::{ASC 0219}
:*c?:\ac\::{ASC 0226}
:*c?:\ec\::{ASC 0234}
:*c?:\ic\::{ASC 0238}
:*c?:\oc\::{ASC 0244}
:*c?:\uc\::{ASC 0251}

; TILDE
:*c?:\AT\::{ASC 0195}
:*c?:\NT\::{ASC 0209}
:*c?:\OT\::{ASC 0213}
:*c?:\at\::{ASC 0227}
:*c?:\nt\::{ASC 0241}
:*c?:\ot\::{ASC 0245}

; UMLAUT
:*c?:\AU\::{ASC 0196}
:*c?:\EU\::{ASC 0203}
:*c?:\IU\::{ASC 0207}
:*c?:\OU\::{ASC 0214}
:*c?:\UU\::{ASC 0220}
:*c?:\YU\::{ASC 0159}
:*c?:\au\::{ASC 0228}
:*c?:\eu\::{ASC 0235}
:*c?:\iu\::{ASC 0239}
:*c?:\ou\::{ASC 0246}
:*c?:\uu\::{ASC 0252}
:*c?:\yu\::{ASC 0255}

; OTHER
:*c?:\CC\::{ASC 0199} ; french C-cedille
:*c?:\cc\::{ASC 0231} ; french c-cedille
:*c?:\OE\::{ASC 0159} ; O-E ligature
:*c?:\oe\::{ASC 0228} ; o-e ligature
:*c?:\AE\::{ASC 0198} ; A-E ligature
:*c?:\ae\::{ASC 0230} ; a-e ligature
:*c?:\AR\::{ASC 0197} ; A ring (Ångström)
:*c?:\ar\::{ASC 0229} ; a ring
:*c?:\SH\::{ASC 0138} ; S hachek
:*c?:\sh\::{ASC 0154} ; s hachek
:*c?:\ZH\::{ASC 0142} ; Z hachek
:*c?:\zh\::{ASC 0158} ; z hachek
:*c?:\L\::{ASC 0163} ; pound symbol
:*?:\<<\::{ASC 0171} ; left guillemet
:*?:\>>\::{ASC 0187} ; right guillemet
:*?:\euro\::{ASC 0128} ; euro symbol
:*?:\!\::{ASC 0161} ; inverted !
:*?:\?\::{ASC 0191} ; inverted ?
:*?:\0\::{ASC 0176} ; degree sign

As hinted at by the comments at the top of the blockquote, the asterisk between the first two colons in each line tell Autohotkey not to wait for a “separator” character (such as a space or period) to arrive from the keyboard, but to process the hotstring replacement upon arrival of the closing ‘\’ character. The question mark tells Autohotkey to execute the replacement even if we’re in the middle of a string. And finally, the capital ‘c’ tells Autohotkey to distinguish between, say, \ZH\ (which is replaced by Ž) and \zh\ (which is replaced by ž).

Generally speaking, the ‘a’, ‘g’, ‘u’, ‘t’, and ‘c’ second letters correspond to the aigue, grave, umlaut, tilde, and circumflex marks. The letter ‘c’ is also used for the c-cedille, and there are a number of other combinations (e.g., zh) that are roughly the phonetic equivalents of the substituted characters.

Some may think that typing four characters to get one is not efficient. Based on my experience, I must disagree. These hotstrings work, and as far as I can tell, they work everywhere.

3 comments to Painless accented characters…

  • Jeremy Wainwright

    This is excellent, so far as it goes. For example, it enables me to much more easily insert accented characters in the lyrics of German songs in a music-notation program that recognises the ANSI character set but not the short-cuts available in MS Word. However, my attempts to extend your list of hotstrings to include characters from the extended ANSI character set (e.g characters used in Polish and Turkish) have so far not been successful. Using exactly the same syntax as existing items and substituting appropriate letter combinations and the relevant ANSI codes produces a blank. Altering the ‘ASC’ to ‘ANS’ does not help. The AutoHotkey user guide is virtually unintelligible to me, so I hope you can help. In addition, or as an alternative, is there a form of hotstring that can call up characters by reference to their Unicode values?

    Thanks again for a very useful tool.

  • Thierry

    Thanks for your code, it was helpful to make something similar.
    I did a code to avoid to put accents in a program with no accents support.
    Something like:
    :*c?:À::
    :*c?:Á::
    :*c?:Â::
    :*c?:Ã::
    :*c?:Ä::
    :*c?:Å::
    :*c?:Æ::
    :*c?:Ç::
    :*c?:È::
    :*c?:É::
    :*c?:Ê::

    …etc.

    Thank you so much :)

  • Alex

    There is a separate Unicode version of AutoHotkey. Having said that, I have not had the time to figure out how to adapt it for use with Unicode Cyrillic characters.

    Yet. :^)

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>