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 

What is maximum number of simultaneous joysticks?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Lexikos



Joined: 17 Oct 2006
Posts: 2737
Location: Australia, Qld

PostPosted: Sun Jun 22, 2008 12:36 am    Post subject: Reply with quote

jimmythehoffa wrote:
Is there at least a way to get AutoHotKey to detect each USB numeric keypad as an individual device, similar to the way it enumerates the joysticks, so that I can bind a hotkey combination to each key on the numeric keypads?
Not exactly. Using the HID/Raw Input API (directly or via Micah's script), you can detect when a key is pressed and which keyboard device it came from. It isn't a conventional hotkey, though.
Laszlo wrote:
With Micha’s HID dll I can distinguish one of such keypads from the main keyboard, but not from a second or third...
So Micah's script does not show a different device number for each keypad? I would think each should have a different device handle, from which Micah's script derives a logical device number.
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Sun Jun 22, 2008 1:39 am    Post subject: Reply with quote

Lexikos wrote:
Using the HID/Raw Input API ... you can detect when a key is pressed and which keyboard device it came from.
Could you give an example script with API calls? It would be really helpful!

As I understand the application must register the devices it wants to get data from, but there are several layers of data structures and function calls to do it. I did not even get, how to identify a USB keyboard device (with its port and hub number).

Lexikos wrote:
So Micah's script does not show a different device number for each keypad? I would think each should have a different device handle, from which Micah's script derives a logical device number.
When I connect a USB numeric keypad, I see in Micha’s script four keyboards, all with Usage = 6, Usage page = 1. Registering any of them causes key presses on the main keyboard and on the USB pad to be shown exactly the same way. There are also 5 HID devices shown. Registering one of them causes keystrokes on the main keyboard to be captured, but not on the USB pads. This distinguishes the main keyboard. Registering any other HID device has no effect (except freezing the PC for 20 seconds).
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2737
Location: Australia, Qld

PostPosted: Sun Jun 22, 2008 7:23 am    Post subject: Reply with quote

Human Interface Devices are registered by Usage and Usage Page. Since all standard keyboards share the same Usage and Usage Page, registering one will register all.

In Micah's AutoHotkeyRemoteControl.ahk, 'nHandle' is the device handle. It is the return value from AutohotkeyRemoteControl\GetWM_INPUTHIDData(), but can also be retrieved from lParam of the WM_INPUT message:
Code:
hDevice := NumGet(lParam+8)
AutohotkeyRemoteControl\GetNumberFromHandle() is used to convert the device handle to a more usable device number, probably based on the order in which devices are enumerated.

Look for "Respond from device:" near the middle of the GUI - the device number should be shown there. (I can't confirm atm since I'm on Ubuntu and wine doesn't support the Raw Input API.)
Quote:
Registering any other HID device has no effect (except freezing the PC for 20 seconds).
That doesn't sound good...
Back to top
View user's profile Send private message
Z Gecko
Guest





PostPosted: Sun Jun 22, 2008 12:08 pm    Post subject: Reply with quote

I just found this post: http://www.autohotkey.com/forum/post-203408.html
It introduces GlovePIE.
Among other interesting features, it is able to recognize and distinguish input from multiple mice and keyboards.
Back to top
evan
Guest





PostPosted: Sun Jun 22, 2008 1:03 pm    Post subject: Reply with quote

are u looking for a clicker?
one of my classes uses clicker with more than 300ppl in the room
we used that to do MC quizzes and take attendance

https://ssl.uh.edu/infotech/php/template.php?software_id=198
Back to top
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Sun Jun 22, 2008 1:20 pm    Post subject: Reply with quote

Z Gecko wrote:
I just found this post: http://www.autohotkey.com/forum/post-203408.html
It introduces GlovePIE.
It is a pity that they mix in politics to the usage conditions. Don’t trust software, which promote political agendas!
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Sun Jun 22, 2008 1:40 pm    Post subject: Reply with quote

evan wrote:
are u looking for a clicker?
Unfortunately, these systems are not cheap:
32 pack RF: $2995, IR: $1995
A comaprison is here.

A cheaper one http://www.h-itt.com/:
- 32 IR (infrared) remote transmitters, 1 IR (infrared) Base Unit, a 6 ft. USB cable, and a carrying case = $795.00
- 32 RF remote transmitters, 1 RF Base Unit, a 6 ft. USB cable, and a carrying case = $1395.00
Back to top
View user's profile Send private message
Z Gecko
Guest





PostPosted: Sun Jun 22, 2008 1:47 pm    Post subject: Reply with quote

Oh, i totally missed that
(being a bit lazy when it comes to read licence agrements),
now i found:
Quote:
* You may not export this software to Israel, or use it in Israel (including the occupied territories), until Israel has ended its occupation of the West Bank, Gaza Strip, Lebanon, Syria, and anywhere else it may occupy, or until Israel abolishes apartheid (granting all Jews and non-Jews in its territories equal rights). If you try to run it in Israel before then, it will give you an error.

Very odd, indeed.
Back to top
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Sun Jun 22, 2008 4:12 pm    Post subject: Reply with quote

If you know C#, you can appreciate the toolkit and demo here. I tried, it distinguishes between multiple keyboards/keypads (XP+). Can someone convert the code to AHK?

SDGT can handle multiple mice, too, and provide multiple cursors.
Back to top
View user's profile Send private message
jimmythehoffa



Joined: 20 Jun 2008
Posts: 5

PostPosted: Mon Jun 23, 2008 2:12 am    Post subject: Reply with quote

This is all such great advice, thanks so much!

Laszlo, your last post was extremely helpful and right on target, because I am indeed trying to do all this in C#. The links you've provided are extremely useful, and they give me even more ideas to implement. The software you've listed would allow me to implement these controls directly in C#, which would be a much more robust way of controlling the application instead of having to rely on intput from AutoHotKey, with the drawback of being more complex to implement.

I am in fact trying to emulate the 'clickers' as mentioned above, but I am trying to implement them in a much less expensive way.

I have found an alternative that allows me to exceed the 16-joystick limitation in a somewhat tricky way, similar to all of the hardware implementations suggested by Laszlo. The BUZZ! controllers for the Playstation 2 are basically 4 handheld input devices with 5 buttons each, all of which are connected via 1 USB cable. According to the following forum:

http://gameshow.ipbhost.com/lofiversion/index.php/t14510.html

all 4 input devices are actually one single 20-button controller, with 5 buttons on each controller. The buttons map out as follows:

Quote:

Controller 1 maps as buttons 1-5, starting at 1 for the big red button and then going 5-4-3-2 on down the line.

Controller 2: 6-10-9-8-7.
Controller 3: 11-15-14-13-12.
Controller 4: 16-20-19-18-17.


So far, this seems to be the simplest way of bypassing the 16-joystick limitation, as it would allow for a total of 64 input devices simultaneously.

However, I was looking for a more flexible alternative, with the option to have more than 5 input buttons and not to have to buy into one specific technology, such as having to depend on the availability of the BUZZ! controllers, which may not always be available, whereas USB keypads/keyboards will probably be around for a very long time.

I was also thinking about the idea of using remote control devices and one single receiver hooked up to the computer. I was thinking about implementing this idea using Micah's script and WinLIRC to detect the incoming infrared signals from each remote. This would require the use of programmable remotes, I think, where each remote is programmed to send a different signal for each of the buttons than those sent by the other remotes. However, I don't know if using several infrared remote control devices simultaneously would cause interference between the received signals, which would cause a faulty reading. I have to look into that.

I really appreciate everyone's input. It has given me a lot more to work with. I'll keep you updated on the progress.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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