Add Emoji Characters to Any Windows Document (AutoHotkey Hotstrings)

Why Search Through Pop-up Tools When You Can Directly Enter Any Emoji into Your Documents, E-Mails, and Web Editing Windows with AutoHotkey?

“I went to the 🏖 on a 🌞day. The 🌞 was so 🔆 that I needed to wear 🕶. I was lucky enough to see a 👩 in a 👙🖐 to me. I saw 🌊s, ⛵s, 🌈s, and a 🦄. Maybe, I had a few too many 🍻s.” 🙄

Years ago I wrote about an AutoHotkey app called WinCompose: a Robust Compose Key for Windows which adds special characters to any Windows document or Web editing field. It appeared to use the Input command in conjunction with a “Compose” key to enter memorable keystrokes for inserting special characters. WinCompose has since converted to a different programming language and added emoji support. Similar to emoticons, emojis add special cartoon-like pictograms to your documents. Unlike emoticons, many programs recognize emojis—as long as the software includes UTF-8 support.

I took another look at WinCompose for possible inclusion the ComputorEdge Software Showcase and came to the conclusion that, while valuable for non-AutoHotkey users, it didn’t do much beyond what you can do with ordinary AutoHotkey Hotstrings. As a test, I used Regular Expressions to convert the list of emojis found at into over 1,000 emoji Hotstrings. (See my book Beginner’s Guide to Using Regular Expressions in AutoHotkey to learn powerful Regular Expression techniques.) You can find the Hotstring file EmojiInsert.ahk at the “ComputorEdge Free AutoHotkey Scripts” page.

The Difference Between Emoticons and Emojis

Library BenefitsThe concept of emojis started with the older text emoticons consisting of punctuation and selected letters to create simulations of human facial expressions—sideways. For example, typing the symbols:

 :) or :( or 8O

represent 🙂 a smiley face, 😦 a sad face, and 😯 a shocked face, respectively.

In earlier days, you could only express feelings on your computer by entering the text characters which looked similar to the emotion—turned 90° counter-clockwise. Eventually, programs started interpreting the text and replacing it with an icon (called an emoticon, as shown above). However, the implementation of emoticons depends upon the program. Each software package requires the ability to detect the set of characters and a special lookup table of replacement icons.

As a demonstration, the WordPress site I use for this blog includes a setting for interpreting the text emoticons. When turned on, the WordPress server sends the icon to your browser rather than the typed text characters. In the example above,  I show the emoticon text as code in an uninterpreted preformatted style, then, following on the next line, I entered the same code without limiting the WordPress interpretation of the inserted text. WordPress converts them to the displayed graphic icons rather than the original punctuation characters.

That means you need to deal with emoticons program by program. Emojis solves this software dependency problem. Rather than interpreting a series of punctuation marks and letters, the Unicode Consortium assigns a code to each image allowing a huge expansion in the number of possibilities. In order to support emojis, the software only needs to know how to interpret each code. That means you can easily use AutoHotkey to insert emojis into any program which supports them. If a program handles UTF-8 Unicodes, then it supports emojis.

Each program might display emojis in a distinct manner. For example, after saving a file with UTF-8 encoding in Windows Notepad, the look of each varies depending on the selected font. Most fonts show a standard emoji, but the special Windows font Segoe UI Emoji shows more detailed icons.

Note: If you don’t see emojis in some Windows Office products, the  Segoe UI Emoji font may be missing.

Emohi Characters
This image shows how emojis may appear in three different applications—although, each uses the same code for the corresponding icon.

The Emoji Hotstrings

The original file for EmojiInsert.ahk created from the list of emojis at includes many long, hard-to-remember text strings. Although I adjusted how a number of the Hotstrings work, I did not cleaned up the entire file. Nonetheless, I needed to make a few adjustments for certain Hotstrings to work. You will want to make more modifications if you make regular use of this emoji Hotstring file.

Start Each Hotstring with an Exclamation Point (!)

I edited the file in Notepad which allowed me to both save the file with UTF-8 encoding and select Segoe UI Emoji as the default font:

This UTF-8 encoded file displays in Notepad using the Segoe UI Emoji font.

I used Ryan’s RegEx Tester to insert an asterisk between the first two colons and add the exclamation point just before the activation text (:*:!). The asterisk causes the Hotstring to immediately activate after typing the last character.

The exclamation point acts as a signal that the emoji string follows. You won’t find many words which start with the ! punctuation mark. That means whenever you leadoff a string with the exclamation point, you plan to insert an emoji. Optionally, you can use any leading character you like as long as it doesn’t create a real word. (Use the search-and-replace capability to change all the ! marks to your desired leading character.)

This gave me a working copy of EmojiInsert.ahk file, although, not without some problems. First, shorter strings took precedence over longer strings. For example, whenever I typed !man I would immediately get 👨—even when I wanted !mans shoe 👞. I took two steps to deal with the issue.

First, in the shorter string, I changed the * Hotstring option to the o option. This deactivated the instant replacement while removing any pressed end character. Now, to cause the !man replace to work, I must hit an end character such as a space or other punctuation. This allowed the typing of longer strings such as !mans shoe without early activation.

However, the Hotstring !man with turban 👳would activate 👨 after hitting the first spacebar character. As the second step, I made two additional changes to deal with this issue. Using the search-and-replace tool, I substituted all the spaces in the file with hyphens (e.g. :*:!man-with-turban::👳). This eliminated the activation caused by hitting the spacebar in the middle of the string. But, by default, the hyphen also acts as an activation key. Therefore, I rewrote the list of Hotstrings activation characters eliminating the hyphen:

#Hotstring EndChars ()[]{}:;'"/\,.?!`n `t

I chose to remove the hyphen character because, if I combined EmojiInsert.ahk with my main script, it would have little impact on my AutoCorrect.ahk Hotstrings.

Whenever you change the directive #Hotstring EndChars it affects all the Hotstrings in the same app. If you include EmojiInsert.ahk in your main AutoCorrect.ahk file, then those Hotstrings also change their end character responses. (Running the apps separately isolates the changes to the individual scripts.)

Much More Work To Do

I made a few changes but I leave the bulk of the tailoring of EmojiInsert.ahk to you. I know that you’ll find more short Hotstrings superseding longer similar Hotstrings. Many of the short fast-activating Hotstrings with the * option will require changing to the o option (or merely remove the * if you want to retain the end character in the result).

You’ll find numerous Hotstrings too long to remember. In fact, with over 1000 Hotstrings, the odds of recalling most of them remains remote. However, you can add as many easier alternative Hotstrings for the same emoji as you like. Merely, copy-and-paste the Hotstring line and a change the activating text.

By the way, I added fractions at the end of the file. To insert the available fractions use the exclamation point and all the numbers (both the numerator and denominator). For example, !19 enters ⅑. For the only three digit fraction, !110 inserts ⅒.

If you want to create other special character Hotstrings similar to those above, you’ll find them available in the Unicode Charts. Anywhere that you can copy the symbols and paste them into an AutoHotkey script, you’ll find it easy to create Hotstrings. You don’t even need to know the code.

Maybe, we need an easy way to pop-up a menu of emojis. Humm…🤔


This post was proofread by Grammarly
(Any other mistakes are all mine.)

(Full disclosure: If you sign up for a free Grammarly account, I get 20¢. I use the spelling/grammar checking service all the time, but, then again, I write a lot more than most people. I recommend Grammarly because it works and it’s free.)






One thought on “Add Emoji Characters to Any Windows Document (AutoHotkey Hotstrings)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s