我希望能够打开和关闭我的热键。我有像"a=f“或"d=y”这样的热键映射。我希望能够按下一个键并在"a=a“和"a=f”之间来回切换。现在,我正在使用挂起键来完成此操作。问题是:当我想取消暂停时,我必须手动使用鼠标和右键单击取消暂停(因为我的自定义热键不再运行,所以我拥有的取消暂停的键无法识别,因为脚本已挂起)。
我的简单想法是为挂起和挂起设置一个全局热键。但我还没找到过这样的东西。
因此,我制作了一个布尔标志来手动切换。因此,我不应该需要暂停。但只要有一个键,就可以切换旗帜。下面是一些示例代码:
if (flag)
{
a::f
}
else
{
a::a
}我得到重复的热键错误。
发布于 2019-01-20 14:34:23
切换变量的值:
flag := !flag将使标志根据其当前值为真或假。真变成假,反之亦然。
flag := false ; initialize variable
F1:: flag := !flag ; press F1 to toggle the variable's value to true/false
; The #If-directive creates context-sensitive hotkeys and hotstrings:
#If (flag) ; if this variable has the value "true"
a::f
#If ; turn off context sensitivityhttps://autohotkey.com/docs/commands/_If.htm https://autohotkey.com/docs/Variables.htm#Expressions
https://stackoverflow.com/questions/54273883
复制相似问题