在autohotkey推进hotstrings

时间:2015-12-03 14:05:10

标签: autohotkey

我在网站https://jacksautohotkeyblog.wordpress.com/2015/10/22/how-to-turn-autohotkey-hotstring-autocorrect-pop-up-menus-into-a-function-part-5-beginning-hotstrings/找到了这个有效的autohotkey(ahk)代码。

::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

这是带菜单的热字符串脚本。例如,当我输入agin时,我会选择三个选项(again,a gin,aging)。现在我想写下这样的东西:

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

因为我有很多热绳。

2 个答案:

答案 0 :(得分:1)

随着时间的推移,在AHK的最新版本中,它成为可能! 使用选项x允许oneliner中的表达式 无论是:x:... :: OR作为所有行上方的组选项:#Hotstring x

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

答案 1 :(得分:0)

与AutoHotkey Hotkeys不同,它不会像现在这样好,我不相信你可以在AutoHotkey Hotstring的同一行上放置除替换文本之外的任何内容。换句话说,

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

无法正常工作,

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

一样。这是一个多长的字符,但不是压倒性的。