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 

AHKHID - An AHK implementation of the HID functions
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
TheGood



Joined: 30 Jul 2007
Posts: 399

PostPosted: Mon Nov 30, 2009 10:10 pm    Post subject: Reply with quote

Hey guys! Sorry for the late replies. I haven't had much time recently for AHK Sad.

SpiderGames wrote:
I got this to work with a nintendo Wiimote. Problem is the Roll Pitch, acceration and IR sensors dont work. All the buttons work but anythign that needs a feed wont come up. Any ideas?

I'm happy to know that it somewhat works with the Wiimote! I can't really help you troubleshoot it because I don't have the hardware necessary, but all I can say is that if you've already tried all the TLCs related to the Wiimote, then you're out of luck. It would mean that the roll pitch, accelaration and IR sensors transmit information in a different way (not through the raw input model wrapped by AHKHID).


bidomo wrote:
BTW, this little script won't work in Win7 Beta, don't know if it will work later.
soon will find

Do you mean that AHKHID doesn't work on Windows 7? Strange because someone else on the thread said that it worked on their Windows 7 x64 install. Maybe as you said it only works in the final version.


eryksun wrote:
eryksun wrote:
That's almost every remote button, except for a few on the 136->65468 usage (e.g. the green MCE button, DVD, Live TV, and Recorded TV).

The system turns out to be more flexible than I at first thought. All of the 136->65468 entries can be overridden with consumer controls. Now I have every button on 1->12 and only have to register the one usage. Very cool.

Thanks for posting this! That's very good information for people asking the same questions.


bidomo wrote:
gbk wrote:
bidomo wrote:

It's the same for me with the remote, I have to disable keyboard input in it (from registry), and I can fully reprogram it

Can I disable the second keyboard form the registry?

there must be a way...

Hey gbk and bidomo, have you tried doing the steps I listed at the end of this post to suppress the original keypresses?


LastCallAgain wrote:
However, (1) I would hate to reinvent the wheel, so to speak, and (2) I'm fairly new to AHK... so before I go much fartther I was just wondering if anyone else had done something similar? I don't want to be 'that guy' who asks other people to do all the work for him, but if it's alrady out there...

Doesn't seem like anyone did it yet! It shouldn't be too hard to do it. You can come post here if you have a problem. And when you're done, you can post your final script here for the next guy! Wink


rhinox202 wrote:
I would like to be able to get all the other keys working like this, but so far have not been able to. If someone else could figure it out with the provided information, that would be cool.

Hey rhinox202, I don't fully understand what you're trying to say. What do you exactly mean by "all the other keys"? If all you want is to send any standard keypresses to MCE (like "a", "b", etc...), then a WM_KEYDOWN message should work I think.
Back to top
View user's profile Send private message Visit poster's website
dhorizon



Joined: 10 Dec 2009
Posts: 1

PostPosted: Thu Dec 10, 2009 12:16 am    Post subject: Reply with quote

Thanks, this is great

Figured I'd post my usage of the script. I have a MoGo Media Mouse X54. I chose the "Media" version over the "Presenter" version because of this script, and it works great.

I haven't figured out 100% of what I want to (how to play videos embedded in powerpoint presentations.. I figure I could have Autoit go ahead and click at the dead center of the screen, where I usually put videos)

So far, I added controls for VLC, Grooveshark (pause only, can't find other controls), and Powerpoint presentation (next/back/black-screen).

Code:
;Must be in auto-execute section if I want to use the constants
#Include %A_ScriptDir%\AHKHID.ahk

;Create GUI to receive messages
Gui, +LastFound
hGui := WinExist()

;Intercept WM_INPUT messages
WM_INPUT := 0xFF
OnMessage(WM_INPUT, "InputMsg")

;Register Remote Control with RIDEV_INPUTSINK (so that data is received even in the background)
r := HID_Register(12, 1, hGui, RIDEV_INPUTSINK)

;Prefix loop
Loop {
    Sleep 1000
    If WinActive("ahk_class QWidget") Or WinActive("ahk_class VLC DirectX")
        sPrefix := "VLC"
    Else If WinActive("ahk_class ApolloRuntimeContentWindow")
        sPrefix := "Grooveshark"
    Else If WinActive("ahk_class screenClass")
   sPrefix := "Powerpoint"
    Else sPrefix := "Default"
}

Return

InputMsg(wParam, lParam) {
    Local devh, iKey, sLabel
   
    Critical
   
    ;Get handle of device
    devh := HID_GetInputInfo(lParam, II_DEVHANDLE)
   
    ;Check for error
    If (devh <> -1) ;Check that it is my HP remote
        And (HID_GetDevInfo(devh, DI_DEVTYPE, True) = RIM_TYPEHID)
        And (HID_GetDevInfo(devh, DI_HID_VENDORID, True) = 2652)
        And (HID_GetDevInfo(devh, DI_HID_PRODUCTID, True) = 1)
        And (HID_GetDevInfo(devh, DI_HID_VERSIONNUMBER, True) = 0) {
       
        ;Get data
        iKey := HID_GetInputData(lParam, uData)
       
        ;Check for error
        If (iKey <> -1) {
           
            ;Get keycode (we cut off the 04 prefix)
        iKey := NumGet(uData, 1, "UChar")
           
            ;Call the appropriate sub if it exists
            sLabel := sPrefix "_" iKey
            If IsLabel(sLabel)
                Gosub, %sLabel%
        }
    }
}

/*!

Back         04|01 = 1
Play/Pause   04|04 = 4
Next      04|02 = 2
Volume Up   04|08 = 8
Volume Down   04|10 = 16
Mute      04|20 = 32

*/

VLC_1: ;Previous Track
    SendInput p
Return

VLC_4: ;Pause
    SendInput {Space}
Return

VLC_2: ;Next Track
    SendInput n
Return

GooveShark_4: ;Pause
    SendInput {Space}
Return

Powerpoint_1: ;Previous Slide
    SendInput p
Return

Powerpoint_4: ;Black Screen
    SendInput b
Return

Powerpoint_2: ;Next Slide
    SendInput n
Return
Back to top
View user's profile Send private message
bidomo



Joined: 05 Feb 2009
Posts: 36

PostPosted: Mon Dec 14, 2009 9:33 am    Post subject: Reply with quote

TheGood wrote:

bidomo wrote:
BTW, this little script won't work in Win7 Beta, don't know if it will work later.
soon will find

Do you mean that AHKHID doesn't work on Windows 7? Strange because someone else on the thread said that it worked on their Windows 7 x64 install. Maybe as you said it only works in the final version.


Final version here, and still not working, I'm gonna check if there's something wrong in the script and re-check usagepage
Back to top
View user's profile Send private message
TheGood



Joined: 30 Jul 2007
Posts: 399

PostPosted: Tue Dec 15, 2009 6:57 am    Post subject: Reply with quote

bidomo wrote:
TheGood wrote:

bidomo wrote:
BTW, this little script won't work in Win7 Beta, don't know if it will work later.
soon will find

Do you mean that AHKHID doesn't work on Windows 7? Strange because someone else on the thread said that it worked on their Windows 7 x64 install. Maybe as you said it only works in the final version.


Final version here, and still not working, I'm gonna check if there's something wrong in the script and re-check usagepage


Please let me know!
I will be moving over to Win7 myself early next year, so by then I'll be able to better troubleshoot as needed.
Back to top
View user's profile Send private message Visit poster's website
GKBob
Guest





PostPosted: Tue Dec 15, 2009 2:55 pm    Post subject: Reply with quote

But, I am having one small problem. I would like to call it as a reusable function.

I am working with the original code from this thread. Does someone have the insight to illustrate how I may call it multiple times, switching between keyboard and mouse (for example) within the same running script? Smile Thank you for any examples.
Back to top
Polumol
Guest





PostPosted: Fri Dec 25, 2009 6:37 am    Post subject: Reply with quote

Thank you for this script, it works well. But I have 2 separate questions in order of importance:

1] Is it possible to temporarily 'disable' an HID device based only on the HID_GetDevHandle or HID_GetDevName?

2] Is it possible to register a HID device based on just the HID_GetDevHandle or HID_GetDevName?

I am more interested in #1, where I have identified my HID device, have the handle and long DevName string. I would like to be able to shut it off, without effecting other devices if possible.

Thank you for anyone's help who knows this stuff inside out.
Back to top
TheGood



Joined: 30 Jul 2007
Posts: 399

PostPosted: Fri Dec 25, 2009 7:40 pm    Post subject: Reply with quote

GKBob wrote:
Does someone have the insight to illustrate how I may call it multiple times, switching between keyboard and mouse (for example) within the same running script? Smile

I'm not sure I understand what you mean. You don't need to keep re-registering the keyboard and the mouse. You just have to do it once for each TLC, and the data will keep flowing in through your input function as needed.


Polumol wrote:
1] Is it possible to temporarily 'disable' an HID device based only on the HID_GetDevHandle or HID_GetDevName?

It depends what you mean by "disable". If you mean disable in the sense that you want to stop receiving WM_INPUT messages, then it's easy. You just have to de-register the device. But if you mean disable in the sense that you don't want the device to function at all, for the whole computer, then, no, that's not possible with AHKHID.


Polumol wrote:
2] Is it possible to register a HID device based on just the HID_GetDevHandle or HID_GetDevName?

- If you have the handle of a device, you can simply use HID_GetDevInfo() to retrieve the UsagePage and Usage to use in HID_Register().
- If you have the name of a device, then you should already have either its handle, or its index. You can use either to get the UsagePage and Usage from HID_GetDevInfo() and then use them in HID_Register().
Back to top
View user's profile Send private message Visit poster's website
bidomo



Joined: 05 Feb 2009
Posts: 36

PostPosted: Thu Dec 31, 2009 8:30 am    Post subject: Reply with quote

Remote script will not work for me, Windows 7 Professional x64.
Tried the original script, and the modified, nothing, MPC will not attend to my calls, well, it responds and not...

AHkHID indeed works, but not the remote application script, example 2 responds to the remote buttons, and shows exactly the same info as in XP or vista, the remote script will do something if a label does not exist (not declared in script but asked for), it will pop up an error message, but not execute anything if label is found. Not even running a program.
Back to top
View user's profile Send private message
TiDaN
Guest





PostPosted: Wed Jan 06, 2010 1:40 am    Post subject: Reply with quote

First, thank you for this amazing script, it is exactly what I've been looking for!

I am using the MCE Remote first edition, and the only difference with yours is that the relevant key data is at the 10th byte instead of the 6th, so that was a very easy fix.

I have a question though: I'm binding the Media Center key to do a different function and that works, but the OS still receives the original key and opens Media Center.. would you happen to know how to catch the key for good so that windows doesn't interpret them at all?

Thanks again!
Back to top
TiDaN



Joined: 06 Jan 2010
Posts: 1

PostPosted: Wed Jan 06, 2010 4:11 am    Post subject: Reply with quote

I've modified TheGood's exemple a bit and I thought I could share:

Basically, I grew tired of having to declare labels when I simply wanted to send one or more keys as an action.

Code:
    ;[...]
    sLabel := sPrefix "_" iKey
    ; Simply send the content of the variable referenced by %sLabel% if it exists
    if %sLabel% <> 
        SendInput % %sLabel%
    ; Call the appropriate sub if it exists
    If IsLabel(sLabel)
        Gosub, %sLabel%


With this, instead of having to declare for example:
Code:
ZoomPlayer_18:   ; Play/Pause
   SendInput, p
return
ZoomPlayer_19:   ; Toggle Fullscreen
   SendInput, z
return

You can simply do:
Code:
ZoomPlayer_18 := "p"    ; Play/Pause
ZoomPlayer_19 := "z"    ; Toggle Fullscreen


Which is a lot less messy, especially when you have over 150 binds for different applications Smile

Note that this doesn't stop you from using labels if you need to do more complicated stuff, in fact you can use both.
Back to top
View user's profile Send private message
TheArkive



Joined: 06 Jan 2010
Posts: 3

PostPosted: Sat Jan 16, 2010 8:50 am    Post subject: A little help on a stubborn mouse... Reply with quote

Hey guys, I came across these scripts and they are a big help, but I have a few pics that I hope will explain my problems. First off, here is my mouse, and the functions I am having trouble with:



Yes it is the MX5500 Revolution mouse. All functions except 3 are able to be mapped without a driver. The red arrows you see are the 3 functions... "rotate forward", "rotate back", and "press in". These functions produce the following results in the Example 2 and 3 scripts...

I triggered all 3 of these functions in no particular order, and here is the result. When I trigger these functions, basically, there is a result, but in Example 2 all values are zero, and in Example 3 "dX" and "dY" are also always zero.





Every time I trigger one of these 3 functions, "zero" is the response. It is like as if there is more data to identify the keys, but I'm not sure how to access it. I hope to understand how to make this possible so that I can finally use all my mouse functions without Setpoint.exe (a huge pain in the butt ... literally)

Is there any chance someone knows how to view the rest of the data so that I can see the distinguishing values that make these functions unique?
Back to top
View user's profile Send private message
bidomo



Joined: 05 Feb 2009
Posts: 36

PostPosted: Sun Jan 17, 2010 6:04 am    Post subject: Reply with quote

@TheArkive, that's some cool mouse, I'm gonna check what a sidewinder x8 has to say.
Back to top
View user's profile Send private message
TheArkive



Joined: 06 Jan 2010
Posts: 3

PostPosted: Sun Jan 17, 2010 2:05 pm    Post subject: Reply with quote

Thanks bidimo,

By the way, I'm not using the drivers that came with my mouse. You might have to uninstall your mouse driver software to get accurate results...

Anyways, I can use AutoHotKey to remap keys that are recognized easily, but this whole "unrecognized keys" business is throwing me for a loop. I noticed that near the beginning of this script, TheGood posted some pics that showed the full raw input. If I could see that then I might be able to see what parts are changing and then actually distinguish between those key presses, but that is just a guess...

All I know is, the Example 2 script definitely sees those buttons, just can't tell them apart yet.
Back to top
View user's profile Send private message
dvda2k



Joined: 19 Apr 2007
Posts: 28

PostPosted: Sun Jan 17, 2010 4:59 pm    Post subject: Reply with quote

Hi TheArkive. I'm having the exact problem here. With a logitech MX1100, "AHKHID Example 2" sees these special buttons but all fields are 0.
Back to top
View user's profile Send private message
TheArkive



Joined: 06 Jan 2010
Posts: 3

PostPosted: Sun Jan 17, 2010 5:30 pm    Post subject: Reply with quote

I'm guessing you mean the buttons the red arrows are pointing at?



The buttons the orange arrows are pointing at work fine for me (on my MX5500).

The top button is "Browser_Search"
The forward and back buttons are:
"XButton1"
"XButton2"

So as an example you can use something like this:

Code:
XButton1::
  (put function here)
return


... to map them.

EDIT: I see that the top button is also recognized as a keyboard stroke. And I do see that when using Example 2, and using mouse settings (usage 1 ... usage page 2) it is yet another button that lists all zeros. So I guess I stand corrected, I have 4 functions on my mouse that I can't distinguish between.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
Page 9 of 10

 
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