微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 AutoHotInterception 中使用键盘和外部小键盘

如何解决在 AutoHotInterception 中使用键盘和外部小键盘

我需要的是将我的键从外部小键盘映射到键盘上的键。我决定使用 evilC 的 AutoHotInterception 程序。总体目标是能够在我的键盘上使用 Windows 鼠标键。我已经到了程序注册来自我的小键盘键盘的输入的地步,我可以用我的键盘输入数字,但它并没有真正影响 Windows 鼠标键。

这是我目前所拥有的:

#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk

AHI := new AutoHotInterception()

keyboardId := AHI.GetKeyboardId(0x04D9,0x8008)
numPadId := AHI.GetKeyboardId(0x0C45,0x7663)

AHI.SubscribeKeyboard(numPadId,true,Func("KeyEvent"))
AHI.SubscribeKeyboard(keyboardId,Func("KeyEvent"))

return

KeyEvent(code,state){
ToolTip % "Keyboard Key - Code: " code ",State: " state    
if (state) & (code=30)
{
    Send,{NumpadUp}
}
}

^Esc::
    ExitApp

解决方法

主要问题是您需要在硬件驱动程序级别发送输入以触发 WMK。

那么我想说你的问题看起来很奇怪。好像自相矛盾?
您想从外部键盘重新映射键,但又说您只想将小键盘与主键盘一起使用?那么外接键盘究竟是做什么用的呢?

无论如何,这里有一些建议和修改后的脚本,您可能可以适应自己的使用。所以首先真的没有必要订阅整个键盘。只需订阅您想要的密钥。

而且由于我不太清楚您实际上要做什么,因此我将展示一个示例,说明您如何重新映射 ASDNumpad1Numpad2Numpad3 在硬件驱动程序级别。

#include Lib\AutoHotInterception.ahk

AHI := new AutoHotInterception()

;kind of optional 
;if you don't switch up stuff,you'll always have the same id
keyboardId := AHI.GetKeyboardId(...,...)

;binding arguments to the function object to make use of the same function over and over
;so don't need to define a new function for each key
AHI.SubscribeKey(keyboardId,GetKeySC("a"),true,Func("KeyEvent").Bind(GetKeySC("numpad1")))
AHI.SubscribeKey(keyboardId,GetKeySC("s"),Func("KeyEvent").Bind(GetKeySC("numpad2")))
AHI.SubscribeKey(keyboardId,GetKeySC("d"),Func("KeyEvent").Bind(GetKeySC("numpad3")))
return

;the key argument will be the argument we bound to the function object above
;the AHI library takes care of passing in the state argument
KeyEvent(key,state)
{
    global keyboardId
    AHI.SendKeyEvent(keyboardId,key,state)
}

^Esc::ExitApp

发送输入记录在此处here

(附带问题,你有没有可能为 OSRS 做这件事?)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。