【发布时间】:2021-02-02 21:49:56
【问题描述】:
我在 AutoHotKey 中使用热字符串,输出取决于字符是否大写。有没有办法确定触发热键的键中的字符是否大写?我尝试使用 A_ThisHotkey,但它似乎不区分大小写。如果您有解决方案,请告诉我。谢谢。
【问题讨论】:
标签: autohotkey
我在 AutoHotKey 中使用热字符串,输出取决于字符是否大写。有没有办法确定触发热键的键中的字符是否大写?我尝试使用 A_ThisHotkey,但它似乎不区分大小写。如果您有解决方案,请告诉我。谢谢。
【问题讨论】:
标签: autohotkey
我不知道执行此操作的内置方法,但也许您只需创建更多热字符串并使用C option 来区分大小写,如下所示:
:C:hello::
:C:Hello::
:C:HeLLo::
:C:HELLO::
MsgBox, % A_ThisHotkey
return
来自 cmets 的示例请求:
hotstrings := "hello,HELLO,HeLlo,HellO,hElLo,hellO"
for each, hotstring in StrSplit(hotstrings, ",")
Hotstring(":CB0*?:" hotstring, Func("MyFunction"))
return
MyFunction()
{
MsgBox, % "Hotstring triggered!`n" A_ThisHotkey
}
【讨论】:
Hotstring() function 自动生成热字串,这样会更可行。
hotstrings 中由 , 分隔的所有热字符串。
您可以在定义热字串之前激活case sensitivity option
#Hotstring c
::Hello::Hi ; will be triggered only if you exactly typed these letters case-sensitive
【讨论】: