1
votes

I found this working autohotkey (ahk) code from the website https://jacksautohotkeyblog.wordpress.com/2015/10/22/how-to-turn-autohotkey-hotstring-autocorrect-pop-up-menus-into-a-function-part-5-beginning-hotstrings/ .

::agin:: 
TextMenu("again,a gin,aging") 
Return


::duh:: 
TextMenu("what,huh,you're joking")
Return


TextMenu(TextOptions)
{
  StringSplit, MenuItems, TextOptions , `,
  Loop %MenuItems0%
  {
    Item := MenuItems%A_Index%
    Menu, MyMenu, add, %Item%, MenuAction
  }
  Menu, MyMenu, Show
  Menu, MyMenu, DeleteAll      ;Moved from MenuAction:
}

MenuAction:
  SendInput %A_ThisMenuItem%{Raw}%A_EndChar%
Return

This is a hotstring script with menu. For example when I type agin I get a many with three options (again,a gin,aging) to choose. Now I want to write it something like this:

agin=again,a gin,aging
duh=what,huh,you're joking
qwe=qwe,qww,ere

Because I have a lot of hotstrings.

2

2 Answers

2
votes

As time has passed, in the most recent version of AHK it became possible to do!
Use option x to allow expressions in the oneliner.
Either as :x:...:: OR as a group option above all lines: #Hotstring x

:x:agin::TextMenu("again,a gin,aging")
0
votes

As nice as it would be, unlike AutoHotkey Hotkeys, I don't believe you can put anything other than replacement text on the same line of an AutoHotkey Hotstring. In other words,

::agin::TextMenu("again,a gin,aging")

would not work while,

::agin:: 
   TextMenu("again,a gin,aging") 
Return

does. It is a few more characters long, but not overwhelming.