10

I have set up a small AutoHotkey script that uses hotstrings to allow me to type a few emoji and other special characters:

#SingleInstance force

#Hotstring * ?

::–::–
::†::†

::π::

::&shrug;::¯\_(ツ)_/¯
::&tm;::™
::&c;::©
::&r;::®
::&tableflip;::(╯°□°)╯︵ ┻━┻
::&music;::♫
::&piano;::
::&cmark;::✓
::&xmark;::✗
::&hourglass;::⌛

The script is also available on PasteBin.

It all works in my text editor: screengrab from text editor

However, some replacements don't work everywhere, for example in Telegram Desktop: screengrab from Telegram Desktop

Both emoji were originally copied from Telegram Desktop, so they are definitely supported in it.

Why isn't this working as expected?

I'm running AutoHotkey Unicode 64-Bit in version 1.1.23.3 on Windows 10 (version 1511), Sublime Text 3 (3103) and Telegram Desktop 0.9.28.

fefrei
  • 885
  • 1
  • 10
  • 27
  • I'm a bit afraid that this is some Unicode problem that is lost when the code is processed by Stack Overflow, but I provided an inline copy nonetheless. – fefrei Mar 16 '16 at 12:19
  • I fixed this problem by opening by script in windows notepad and saving. I normally work in notepad++ (UTF-8) but apparently something wasn't saving properly. – jiggunjer Aug 31 '16 at 13:33
  • @jiggunjer you need to make sure the file has the Byte-Order-Mark. – Synetech Aug 22 '22 at 15:33
  • 1
    @fefrei, the problem with this and some other programs is in how they process input. They don't just take keystrokes like a normal program, they process every key you press, which interferes with AHK's ability to send keys. You can try the different send modes (input, event, play, raw), and different delays, but as others have found, you might have to resort to just using the clipboard. – Synetech Aug 22 '22 at 15:36

1 Answers1

5

I answered a similar question in the past: Autohotkey Replace 2 specific character with one
I don't really know what the problem was, but we managed to get around the problem by making use of the clipboard. Maybe the same method can be used for your scenario.

Community
  • 1
  • 1
Forivin
  • 14,780
  • 27
  • 106
  • 199
  • 1
    That works for me – thanks! I'd still love to know the underlying problem, though... – fefrei Mar 16 '16 at 16:37
  • For that we'd have to find out what input methods both the clipboard and autohotkeys hotstrings are using. – Forivin Mar 17 '16 at 08:47
  • Just an idea: Autohotkey has several ways of sending text. It's possible that your Telegram Desktop handles them differently. Try `Send`, `SendInput` and `SendPlay`, `SendEvent`. They all share the same syntax. And then there is `ControlSend`, `ControlSetText` and `PostMessage`/`SendMessage`. Those are definitely more complicated to use, but maybe they'll do the trick. – Forivin Mar 21 '16 at 10:04
  • I tried the four basic methods – none of them work, but some break even in my text editor. – fefrei Mar 21 '16 at 19:10
  • Can you summarize or quote your linked answer? – Stevoisiak Aug 16 '17 at 20:42