Hallo.
Like the title.
I have 3 keyboards connected to the PC.
When I press a key on a keyboard I want to detect what keyboard pressed that key.
Is it possible? How?
Thank you very much
Distinguish between 3 connected keyboards
Re: Distinguish between 3 connected keyboards
AutoHotInterception by evilC
It's not a trivial task.
It's not a trivial task.
Re: Distinguish between 3 connected keyboards
I know.
Is it possible by AutoHotKey?
I hope yes...
Is it possible by AutoHotKey?
I hope yes...
Re: Distinguish between 3 connected keyboards
Afaik, you need to access a lower system level than normal AHK remapping does. There is AHKHID, but it also has certain restrictions, if I remember correctly.
There is also that guy who used HID with Lua to run AHK scripts, or smth like that... https://www.youtube.com/watch?v=Arn8ExQ2Gjg
There is also that guy who used HID with Lua to run AHK scripts, or smth like that... https://www.youtube.com/watch?v=Arn8ExQ2Gjg
Re: Distinguish between 3 connected keyboards
Interesting.
It tell Lua macros with AutoHotkey can do it, but it no tell how.
Can you tell me some thing about? Or other systems?
Thank you very much
It tell Lua macros with AutoHotkey can do it, but it no tell how.
Can you tell me some thing about? Or other systems?
Thank you very much
Re: Distinguish between 3 connected keyboards
There are a couple of links under the YT video (expand the description). I have only tried AHI some time ago - seemed to work fine.
Perhaps others have more ideas.
Perhaps others have more ideas.
Re: Distinguish between 3 connected keyboards
I don't know if there's a limitation on 3 versus 2 keyboards, but I just set up the combination of EvilC's Autohotinterception, interceptiontaphold, and tapholdmanager, and the Interception driver to separate inputs from my TKL and my separate numpad. It works as advertised and wasn't too difficult - my competence is only slightly higher than my black Lab (who's admittedly brighter than the brown...)
Here's the relevant portions of the script:
and
and
Here's the relevant portions of the script:
Code: Select all
#Persistent
#SingleInstance force ; Ensures that only the last executed instance of script is running
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir, %A_ScriptDir% ; Ensures a consistent starting directory.
Menu, tray, icon, %A_ScriptDir%\Media\jjk.ico
#Include <Vis2>
#Include <AutoHotInterception>
#include <InterceptionTapHold>
#include <TapHoldManager>
#Include %A_ScriptDir%\lib\
#include biga\export.ahk
#Include array\export.ahk
#Include stringsimilarity\export.ahk
#Include json\export.ahk
Code: Select all
AHI := new AutoHotInterception()
KeyboardID1 := AHI.GetKeyboardId(0x0C45, 0x7692) ; Keyboard identifier for IHT
KeyboardID2 := AHI.GetKeyboardId(0x04B4, 0x0901) ; Numpad identifier to IHT
ITH1 := new InterceptionTapHold(AHI, KeyboardID1) ; Keyboard assignments via IHT
ITH1.Add("Capslock", Func("CapsMenu")) ; Caps to disabled v. Capsmenu
ITH1.Add("F3", Func("SearchMenu")) ; F3 to search menu v. quick search
ITH2 := new InterceptionTapHold(AHI, KeyboardID2) ; Numpad assignments via IHT
ITH2.Add("Esc", Func("NPEscape")) ; Escape to !F1
ITH2.Add("Tab", Func("NPTab")) ; Tab to !F2
ITH2.Add("Backspace", Func("NPBackspace")) ; Backspace to #C
ITH2.Add("NumpadEnter", Func("NPEnter")) ; Program-specific Enter remaps
Code: Select all
SearchMenuHotkey(isHold, taps, state){
if (taps==1) {
Menu, SearchMenu, Show
Return
}
else if (taps==2) {
DDGSearch()
return
}
else if (taps==3) {
Send, {F3}
Return
}
}
CapslockSemiDisable(isHold, taps, state) {
If (taps==2) {
counter = 0
Gosub, CAPSMENU
if (stringGlobal){
clipboard := stringGlobal
Return
}
else {
Clipboard := OldClipboard
Return
}
}
}
NumPadEnterFunc(){
If WinActive("Calculator ahk_class ApplicationFrameWindow, Calculator") {
SendInput, {Enter}
SendInput, ^c
return
}
Else If Winactive("ahk_exe excel.exe") {
Send, {NumpadEnter}
sleep, 0.2
Return
}
Else {
SendInput, {=}
sleep, 0.2
Return
}
}
NumPadEscapeFunc(){
If WinActive("ahk_exe brave.exe") {
SendInput, {Alt}{f1}
Return
}
Else {
SendInput, {F1}
Return
}
}
NumpadTabFunc(){
If WinActive("ahk_exe brave.exe") {
SendInput, {Alt}{f2}
Return
}
Else {
SendInput, {F2}
Return
}
}
NumPadBackspaceFunc(){
if WinExist("Calculator ahk_class ApplicationFrameWindow", "Calculator") {
WinActivate
return
}
else {
Run calc.exe
return
}
}