我用autohotkey 的 增强插件 AutoHotInterception GitHub - evilC/AutoHotInterception: An AutoHotkey wrapper for the Interception driver 结合RightKeyboard GitHub - agabor/RightKeyboard: Set the right layout for each phisical keyboard you have 的思路,写了一个双实体键盘可以用的ahk简单脚本。
同时避免了RightKeyboard会吞掉切换键盘后吞掉第一个字母的缺陷,可谓是完美啦!!!
如图,来回用两个键盘各按5次s键的结果:
第一步,按照 GitHub - evilC/AutoHotInterception: An AutoHotkey wrapper for the Interception driver 的 Setup部分指导,安装好。
第二步,通过AutoHotInterception文件夹下Monitor.ahk想办法确定里面哪两个键盘的vid hid 是目标键盘,可以拔掉键盘挨个试一下。
第三步,把以下代码新建ahk拷贝到AutoHotInterception文件夹下。用上一步复制的两个id替换代码里的两处,运行并开始你的双键盘之旅吧。
(只举了s键的例子,复制后补全26个字母就好了)
#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk
temp := 1
AHI := new AutoHotInterception()
id1 := AHI.GetKeyboardId(0x0433, 0x0004, 1)
cm1 := AHI.CreateContextManager(id1)
AHI := new AutoHotInterception()
id2 := AHI.GetKeyboardId(0x1A2C, 0x2D43, 1)
cm2 := AHI.CreateContextManager(id2)
return
#if cm1.IsActive
s::
{
if (temp = 2)
{
send,#{space}
sleep,200
temp := 1
sendinput,s
return
}
else
{
sendinput,s
}
return
}
#if
#if cm2.IsActive
s::
{
if (temp = 1)
{
send,#{space}
sleep,200
temp := 2
sendinput,s
return
}
else
{
sendinput,s
}
}
楼主测试好用的话,给点个赞吧!