3

For example, I want to be able to type (right arrow) using AutoHotKey's text replacement feature, and this is what my script looks like:

::|rarr::{ASC 2192}

So when I type |rarr in my text editor and hit , . <SPACE> <ENTER>, etc the text should be replaced with a . But for some reason, I get this: É.

Usually that works for ASCII and ANSI characters. Should it be done differently with Unicode? If so, how?

4

If your code works depends on the receiving application. The help says for {ASC nnnnn}:

[...]

Unicode characters may be generated by specifying a number between 256 and 65535 (without a leading zero). However, this is not supported by all applications. For alternatives, see the section below.

Relevant section from remarks:

Unicode characters are supported directly as text in Unicode versions of AutoHotkey, or using {U+nnnn} notation in any version.

So if you are using a Unicode AHK build:

::|rarr::→

If not:

::|rarr::{U+2192}

(Tested with AHK Unicode 64-bit 1.1.15.01)

  • Hi, I don't think AHK has different versions like you suggest; at least, it's changed since the last time you installed/updated AHK. The website (autohotkey.com) only lists one version. Can you please take a good look? – its_me Jul 14 '14 at 16:53
  • OK, I just found out that that site is old and this (ahkscript.org) is the new one; how lame of me! By the way, only the last one worked for me, i.e. ::|rarr::{U+2192} – its_me Jul 14 '14 at 17:04
  • @its_me You're using Unicode AHK (check description column in task manager of running script) and the first one doesn't work? What encoding uses your script file? Mine uses UTF-8 (with bit order mark). – hippibruder Jul 14 '14 at 17:58
3

I wrote this AHK script to send unicode characters to any application by pressing WinKey+U and typing Character's 4-digit Hex Value:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Unicode Support
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#U::SendUnicode()
SendUnicode()
{
    Input, hex, l4
    Send {U+%hex%}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0

Autohotkey-script for converting LaTeX-like input to unicode characters

"Ctrl+Alt+Shift+U" toggles it on and off (look at the bottom right icon to see it's in suspense mode (icon S) of active mode (icon H).

Test: αβΓ∞


See more: Replacing latex with unicode symbols

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.