我想将键盘的一部分映射为数字键盘:(我的笔记本电脑键盘没有数字键盘)
j->1
k->2
l->3
u->4
i->5
o->6
I would like to toggle the mapping with a short cut, let's say Control+Alt+M,
my code is below, however, I don't know how to reset the mapping:
mode = 0
^!m::
if (mode = 1)
{
mode = 0
j->1
k->2
l->3
u->4
i->5
o->6
}
else
{
mode = 1
u::u ;got error here: duplicate hotkey
}
return
I got duplicate hotkey error with u::u
, seems AHK does not allow mapping more than one key in a script.
GetKeyState("NumLock", "P")
does not work because I have no NumLock.
我能够用这段代码实现:
^!m::
Suspend
u::4
i::5
o::6
return
但这会切换整个脚本,这显然不好。所以我想要一个比这更好的解决方案。
如果您运行 AKH_L(例如 AutoHotkey v1.1.10.01),则可以使用 #IF 语句来控制热键(就像您使用 #IfWinActive 在应用程序级别控制热键一样)。
Mode := 0
^!m::
mode:=!mode ;not! toggle
return
#If mode ; All hotkeys below this line will only work if mode is TRUE
j::1
k::2
l::3
u::4
i::5
o::6
#If
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)