| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Fri Feb 24, 2006 1:11 pm Post subject: MULTIPLE keyboards: WHICH keyboard sent a keystroke? |
|
|
hi!
as you probably know, there exist usb devices that provide an external numerical block for notebooks.
now imagine using autohotkey to detect WHICH keyboard sent a keystroke: the "normal" keyboard OR the usb numerical block. this could turn the external numerical block into a low cost (~ 5 €) hotkey "board" having 17 freely definable hotkey buttons.
is this detection WHICH keyboard sent a keystroke possible with autohotkey?
thanks!
rh |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Fri Feb 24, 2006 2:27 pm Post subject: |
|
|
There's currently no built-in way to distinguish between multiple mice or keyboards. On Windows XP, there might be a way to do it using DllCall + RegisterRawInputDevices + OnMessage (OnMessage would be used to have the script receive WM_INPUT messages).
Although I have no experience with it yet, I plan to look into it someday. |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1237
|
Posted: Fri Feb 24, 2006 2:33 pm Post subject: |
|
|
You can try out the USB HID script I wrote for USB keyboards based on Micha's work to see if you can distinguish or even make hotkeys directly (only if the extra buttons are treated as special buttons which windows doesn't normally react to when the manufacturer's software isn't installed - so probably not in this case, unlike media keys on keyboards).
Warning: Not exactly simple to use but read the comments in the scripts and you should get some idea:
http://www.autohotkey.com/forum/viewtopic.php?t=7135 |
|
| Back to top |
|
 |
Veovis
Joined: 13 Feb 2006 Posts: 389 Location: Utah
|
Posted: Fri Feb 24, 2006 4:50 pm Post subject: |
|
|
Interesting idea. I dislike the numeric pad that is on a laptops keyboard (its like diagonal and i always forget to take numlock off, and then as a i type words numbers come up) so i got used to using the numbers on top of the keyboard. Now if i had a external numpad i would use it as alot of hotkeys. In my case since i never use the 'numpad' (i use the 'numrow') i could simply have:
Numpad0::run, firefox
Numpad1::run, something
Numpad2::gosub, somefunction
etc.
This might work for you too.
You could also perhaps have someway of detecting the numlock state so that you can still use the numpad as a numpad if numlock is off. (rewrite pagedown to 3, right to 6, etc.) but i think that would mess up the normal keyboard too... _________________
"Power can be given overnight, but responsibility must be taught. Long years go into its making." |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1237
|
Posted: Fri Feb 24, 2006 5:01 pm Post subject: |
|
|
| That's a good point Veovis - if NumLock is off, then it would be safe to assume that a NumPad key must have come from the USB NumPad - or doesn't the usb NumPad send numbers if NumLock is off? |
|
| Back to top |
|
 |
rh
Joined: 19 Jan 2006 Posts: 15 Location: Heidelberg
|
Posted: Sat Sep 16, 2006 5:02 pm Post subject: |
|
|
hi,
i just wanted to ask, if meanwhile there have been new developments concerning this question.
thanks!
rh |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sun Sep 17, 2006 12:31 am Post subject: |
|
|
| Over at "more joystick axes/buttons", Aljaz sent me his DirectInput code that might be able to distinguish between multiple keyboards (i.e. that are all connected to the same PC simultaneously). However, he didn't have the time to implement it as a prototype DLL, and it might be 6 months or longer before I get to it. |
|
| Back to top |
|
 |
Lemming
Joined: 20 Dec 2005 Posts: 165 Location: Malaysia
|
Posted: Sun Sep 17, 2006 3:25 pm Post subject: Can be useful |
|
|
I actually make use of this "limitation". In fact, it's a useful feature for me. I have one of those laptop keypads hooked up to my desktop. I use it for games and it is placed on the left of my main keyboard.
I have various scripts assigned to the numpad keys, so now it is really easy to activate them with my left hand - I don't need to reach across to the right side of the keyboard, nor do I need to let go of the mouse. Since AHK doesn't care which keyboard I use, either numpad would work.
Incidentally, you can get them really cheap from eBay; just search for "numeric keypad" or "laptop keypad". Your local computer store may also stock them.
As for getting more hotkeys, have you tried Custom Combinations yet?
You can do stuff like:
| Code: | | Numpad0 & Numpad2::Run Notepad |
So even the 17 keys on the numpad can generate lots of different combinations.
| Chris wrote: | There's currently no built-in way to distinguish between multiple mice or keyboards. On Windows XP, there might be a way to do it using DllCall + RegisterRawInputDevices + OnMessage (OnMessage would be used to have the script receive WM_INPUT messages).
Although I have no experience with it yet, I plan to look into it someday. |
|
|
| Back to top |
|
 |
|