I am trying to make two hyphens trigger a short dash, and three hyphens trigger a long dash; like
:*?:---=::—
:*?:--=::–
except working. Here i
I copied the code below from the AutoHotKey forums:
;IMPORTANT, you must save this script as UTF-8 to make it work.
::!?::
::?!::
PutUni("‽")
Return
::neko::
PutUni("猫")
Return
:?:damn::
PutUni("✩☠#‼")
Return
;Paste UTF8 string (Hex encoded or not) as unicode.
;If you don't use Hex encoding, you must save your script as UTF8
PutUni(DataIn)
{
SavedClip := ClipBoardAll
ClipBoard =
If RegExMatch(DataIn, "^[0-9a-fA-F]+$")
{
Loop % StrLen(DataIn) / 2
UTF8Code .= Chr("0x" . SubStr(DataIn, A_Index * 2 - 1, 2))
}
Else
UTF8Code := DataIn
Transform, ClipBoard, Unicode, %UTF8Code%
Send ^v
Sleep 100 ;Generous, less wait or none will often work.
ClipBoard := SavedClip
Return
}
The PutUni
function will "translate" the desired input to the desired Unicode output.