AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MULTIPLE keyboards: WHICH keyboard sent a keystroke?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Fri Feb 24, 2006 1:11 pm    Post subject: MULTIPLE keyboards: WHICH keyboard sent a keystroke? Reply with quote

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

PostPosted: Fri Feb 24, 2006 2:27 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
evl



Joined: 24 Aug 2005
Posts: 1237

PostPosted: Fri Feb 24, 2006 2:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
Veovis



Joined: 13 Feb 2006
Posts: 389
Location: Utah

PostPosted: Fri Feb 24, 2006 4:50 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
evl



Joined: 24 Aug 2005
Posts: 1237

PostPosted: Fri Feb 24, 2006 5:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
rh



Joined: 19 Jan 2006
Posts: 15
Location: Heidelberg

PostPosted: Sat Sep 16, 2006 5:02 pm    Post subject: Reply with quote

hi,

i just wanted to ask, if meanwhile there have been new developments concerning this question.

thanks!
rh
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sun Sep 17, 2006 12:31 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Lemming



Joined: 20 Dec 2005
Posts: 165
Location: Malaysia

PostPosted: Sun Sep 17, 2006 3:25 pm    Post subject: Can be useful Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group