首页 > 解决方案 > 如何在 AutoHotKey 中获取大写的实际热字串?

问题描述

我在 AutoHotKey 中使用热字符串,输出取决于字符是否大写。有没有办法确定触发热键的键中的字符是否大写?我尝试使用 A_ThisHotkey,但它似乎不区分大小写。如果您有解决方案,请告诉我。谢谢。

标签: autohotkey

解决方案


我不知道这样做的内置方法,但也许你只需创建更多的热字符串并使用区分大小写的C选项就可以了,如下所示:

:C:hello::
:C:Hello::
:C:HeLLo::
:C:HELLO::
    MsgBox, % A_ThisHotkey
return

来自评论的示例请求:

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
}

推荐阅读