如何将任何单词变成 Autoit 命令 - Hotstringset Alternative

How to Make any Words into Autoit Commands - Hotstringset Alternative

我怎样才能将任何单词变成 Autoit 命令?

此代码仅在我键入键盘热键组合时有效(但我想键入一个词来执行 Autoit 代码。)

热键设置示例:

HotKeySet (“{F1}”, “calc”)

Func calc()
Local $iPID = ShellExecute (“calc.exe”)
EndFunc

是否有 Hotstringset 替代品。

我现在可以在 autohotkey 中将任何单词变成命令。

Autohotkey 语言示例:

如果我输入 calc,它将执行 Autohotkey 代码。

:*:calc::
run calc.exe
return

有了这个你可以把任何单词变成自动命令。

第 1 步 - 您可以在此处下载 HotStringSet.zip 文件。 (包含在 HotString.au3 中)HotKeySet vs HotStringSet

步骤 2 - 解压缩 + 手动将 HotString.au3 复制到路径 C:\Program Files (x86)\AutoIt3\Include

第 3 步 - 现在您已准备好在任何 Autoit 脚本中使用 HotStringSet。

您可以在键盘上键入任何文本,例如在写字板中:键入 calc+Space 它将 运行 计算器,如果您键入 kbc+Space 它将替换文本 kbc 进入键盘控制,如果您键入 pi+Space 它将把文本 pi 替换为符号 pi.

编写此 Autoit 代码。

#include <HotString.au3>

HotKeySet ('{F1}', 'quit')

HotStringSet('kbc{SPACE}', replace1)
HotStringSet('pi{SPACE}', replace2)
HotStringSet('calc{SPACE}', replace3)

Func quit()
Exit
EndFunc

Func replace1()
;MsgBox(0,'','You did typed kbc! :)')
send ('{BS 4}keyboard control ') ; replace [kbc] into [keyboard control]
EndFunc

Func replace2()
;MsgBox(0,'','You did typed pi! :)')
send ('{BS 3}{ASC 960} ') ; replace [pi] into [symbol p]
EndFunc

Func replace3()
;MsgBox(0,'','You did typed calc! :)')
Local $iPID = ShellExecute ('calc.exe') ; If you type calc it wil run the application calculator.
EndFunc

While 1
Sleep(10)
WEnd