AutoHotkey Community

It is currently May 27th, 2012, 4:51 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 398 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15 ... 27  Next
Author Message
 Post subject:
PostPosted: April 2nd, 2010, 10:34 pm 
Offline

Joined: November 8th, 2009, 2:46 am
Posts: 234
Location: Canberra Oz
Is there a special driver for it perhaps'


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2010, 11:25 pm 
Offline

Joined: April 15th, 2009, 11:10 am
Posts: 21
Michael@oz wrote:
Is there a special driver for it perhaps'

Yes, it is made by Lenovo. I don't want to remove it because I want to add to its functionality not rewrite it entirely.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2010, 3:24 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
msafi wrote:
I have a ThinkPad laptop with a three button mouse. I couldn't find a way to detect the center button. When I press it, ButtonFlags, ButtonData, and every thing else shows 0. Any ideas how to detect that button?

Thanks,

Your issue sounds very familiar to this user's. Check my response here, which I've recopied here:

Quote:
This issue isn't isolated to your mouse. For example, the mouse wheel tilt isn't natively supported by XP. You need to install the IntelliMouse program in order to use it. Regardless (with or without IntelliMouse), AHKHID cannot differentiate the tilts, and only reports empty messages, exactly like in your case. Simply put, if AHKHID sends back empty messages, then it means that the button isn't natively supported by the raw input device interface.

Although using AHKHID is out of the window, you may be able to use the buttons by installing the proper software. For example, in the case of the mouse wheel tilt, installing IntelliMouse in XP/2000 allows programs to receive a WM_MOUSEHWHEEL message, which you can capture by using an OnMessage function in your script. Hope this helps!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2010, 9:19 pm 
Offline

Joined: April 15th, 2009, 11:10 am
Posts: 21
TheGood,

I have the drivers installed. But I don't know what they cause the button press to send. It's not a standard thing like WM_MOUSEWHEEL. How can I know what message is sent by this button and then capture that message with AHK?

Thanks,

MK


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2010, 12:26 am 
Offline

Joined: November 8th, 2009, 2:46 am
Posts: 234
Location: Canberra Oz
See this for how to trace messages.

Note Winspector Spy is no longer available at that address, see the link at the bottom of SKANs post here.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2010, 7:18 am 
Offline

Joined: April 15th, 2009, 11:10 am
Posts: 21
Michael,

Thanks for the links.

I used Winspector to monitor windows while I use the mystery button on them but simply pressing the mystery button doesn't send any messages to those windows.

The (mystery) center button is used for scrolling. It allows users to scroll by moving the pointing stick while it's pressed.

So, when I simply press the button, no messages are sent, but when I move the pointing stick while the button is pressed, WM_MOUSEWHEEL and sometimes WM_VSCROLL are sent. I'm not interested in those.

I think the driver listens for the button press, but I don't know what it's listening for. In Winspector, I opened a lot of the seemingly relevant processes and windows to see what messages are sent to them when the button is pressed, but I couldn't see anything...

Any more ideas? :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2010, 1:04 pm 
Offline

Joined: March 25th, 2010, 8:57 am
Posts: 9
msafi wrote:
Any more ideas? :(

Run AHKHID's example1.ahk, select "other", scroll to right, take note of Usage Page + Usage numbers. Run example2.ahk, input Usage Page and usage, press add and call, then press the mystery button. If you see nothing, repeat with next Usage Page and Usage.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2010, 1:40 pm 
Offline

Joined: April 15th, 2009, 11:10 am
Posts: 21
Maiklas3000 wrote:
msafi wrote:
Any more ideas? :(

Run AHKHID's example1.ahk, select "other", scroll to right, take note of Usage Page + Usage numbers. Run example2.ahk, input Usage Page and usage, press add and call, then press the mystery button. If you see nothing, repeat with next Usage Page and Usage.


There isn't anything in the "Other" tab. The laptop comes with two navigation devices. The TrackPoint, which is what I'm interested in, and a touchpad. Both devices show in the "Mice" tab. See screenshot:

Image

I tried to use Example 2 script with 1 and 2 values for Usage Page and Usage. But like I said, everything shows 0.

EDIT: actually, I'm not sure the two records shown in the screenshot above represent the TrackPoint and the touchpad. Because one of them shows 5 buttons, which is the total number of buttons in both, the TrackPoint and the touchpad...


Last edited by msafi on April 13th, 2010, 5:35 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2010, 3:55 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
msafi wrote:
So, when I simply press the button, no messages are sent, but when I move the pointing stick while the button is pressed, WM_MOUSEWHEEL and sometimes WM_VSCROLL are sent. I'm not interested in those.

Whatever that button does is simply not supported by AHKHID. The driver you have installed is able to receive input from it at a lower level than AHKHID can, and translates that input into the proper scroll wheel event, like you mentioned. So those WM_MOUSEWHEEL and WM_VSCROLL messages are probably the only visible things that occur.

The best thing you can do in cases like these is to go in the driver's options and see if you can attach a hotkey combination/program launch/anything useable by AHK.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2010, 4:55 pm 
Offline

Joined: April 15th, 2009, 11:10 am
Posts: 21
TheGood wrote:
The best thing you can do in cases like these is to go in the driver's options and see if you can attach a hotkey combination/program launch/anything useable by AHK.

Assigning different functionality to the mystery button through the drivers options would disable the ability to use the scrolling functionality of it. That's not what I want.

The makers of this mouse, Synaptics, provide API to their drivers! Unfortunately, I don't know how to use this API with AHK or natively.

I hope some day before I die I'll finally get my head around Win API. Meanwhile, I posted a request/job on RentACoder.com.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 10th, 2010, 2:54 am 
Offline

Joined: February 5th, 2009, 9:12 am
Posts: 59
A while ago a was saying there could be a problem with the way AHK handles Windows 7, something about AHKHID not working or something alike...


Well, found out something:

Code:
01 01 00 00 00 32 84 0F 80 20 00 00 00                                          Visualization for XP
IR code Goes from 00 to 12 byte length (13 bytes)
01 01 00 00 00 00 00 00 00 32 84 0F 80 00 00 00 00 20 00 00 00 80 FA FF FF      Visualization for Windows 7
IR code Goes from 00 to 24 byte length (25 bytes)


Already tried switching 6th byte for 9th for the remote code, and 7th byte for the 10th byte to check the verifier byte (if is HP Remote), wont work...

Code:
        If (NumGet(uData, 10, "UChar") = 132) or (NumGet(uData, 10, "UChar") = 4)
        {   ;IT'S THE REMOTE
            If (iKey <> -1)
            {
                ;Get keycode (located at the 6th byte)
                iKey := NumGet(uData, 9, "UChar")
               
               
                ;Set prefix
                sDevicePrefix := "HPRem"
               
                ;We're gonna have to call
                bCallEvent := True
               
            }
        }


What could still be wrong???
Anything else AHK works OK in 7, only Remote script is left.

Any help will be appreciated


.::Edit::.

Something changed... updated to latest version of everything (COM, AHKHID), no more 24 bytes, just 14.


Code:
01 01 00 00 00 00 00 00 00 1A 04 0F 80 00 00



Already updated script to reflect the functions names and I'm putting just the relevant part of the script

Code:
; 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 12 17 18 19 20 21 22 23 24
;
;01 01 00 00 00 00 00 00 00 32 84 0F 80 00 00 00 00 20 00 00 00 80 FA FF FF   Vizualize for Windows 7
;01 01 00 00 00 32 84 0F 80 20 00 00 00                              Vizualize for XP
;
;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 := AHKHID_Register(65468, 137, hGui, RIDEV_INPUTSINK)

;Prefix loop
Loop
{
    Sleep 1000
    If WinActive("ahk_class Winamp v1.x") Or WinActive("ahk_class Winamp EQ") Or WinActive("ahk_class Winamp PE") Or WinActive("ahk_class Winamp Gen")
        sPrefix := "Winamp"
    Else If WinActive("ahk_class MediaPlayerClassicW")
        sPrefix := "MPC"
    Else If WinActive("ahk_class eHome Render Window")
        sPrefix := "VMC"
    Else If WinActive("ahk_class MozillaUIWindowClass")
        sPrefix := "Youtube"
    Else If WinActive("ahk_class ShockwaveFlashFullScreen")
        sPrefix := "YoutubeFS"
    Else
    {
        sPrefix  := "Default"
    }
}

Return

InputMsg(wParam, lParam)
{
    Local devh, iKey, sLabel, bCallEvent
   
    Critical
   
    ;Get handle of device
    devh := AHKHID_GetInputInfo(lParam, II_DEVHANDLE)
   
    ;Check for error
    If (devh <> -1) ;Check that it is my HP remote
        And (AHKHID_GetDevInfo(devh, DI_DEVTYPE, True) = RIM_TYPEHID)
        And (AHKHID_GetDevInfo(devh, DI_HID_VENDORID, True) = 1118)
        And (AHKHID_GetDevInfo(devh, DI_HID_PRODUCTID, True) = 109)
        And (AHKHID_GetDevInfo(devh, DI_HID_VERSIONNUMBER, True) = 272)
    {
       
        ;Get data
        iKey := AHKHID_GetInputData(lParam, uData)
       
        ;Check for error
     
        If (NumGet(uData, 10, "UChar") = 132) or (NumGet(uData, 10, "UChar") = 4)  ; Tried A instead of 10
        {   ;IT'S THE REMOTE

            If (iKey <> -1)
            {
                ;Get keycode (located at the 6th byte)
                iKey := NumGet(uData, 9, "UChar")
               
               
                ;Set prefix
                sDevicePrefix := "HPRem"
               
                ;We're gonna have to call
                bCallEvent := True
               
            }
        }
;;This part of the xbox 1 remote can be totally ignored, as I'll probably have to remove it.
        else If (NumGet(uData, 9, "UChar") = 24)
        {   ;IT'S THE XBOX1 controller
            If (iKey <> -1)
            {
                ;Get keycode (located at the 6th byte)
                iKey := NumGet(uData, 5, "UChar")
               
                ;Set prefix
                sDevicePrefix := "XBOX1"
               
                ;We're gonna have to call
                bCallEvent := True
               
            }

        }


        ;Check if we need to call
        If bCallEvent
        {
           
            ;Call the appropriate sub if it exists
            sLabel := sDevicePrefix "_" sPrefix "_" iKey
            If IsLabel(sLabel)
                Gosub, %sLabel%
            else ;If IsLabel(!sLabel)
            {
                sPrefix  := "Default"
                sLabel := sDevicePrefix "_" sPrefix "_" iKey               
                ;If IsLabel(sLabel)
                Gosub, %sLabel%               
                   
            }

        }
       
    }
}



HPRem_Default_12: ;Power
    ;
return

HPRem_MPC_1: ;1 Symbols
    Sendinput 1
return

HPRem_MPC_2: ;2 abc
    ControlSend, VideoRenderer1, {space}, ahk_class MediaPlayerClassicW
return

HPRem_MPC_3: ;3 def
    SendInput 3
return

HPRem_MPC_4: ;4 ghi
    SendInput 4
return

HPRem_MPC_5: ;5 jkl
    SendInput 5
return

HPRem_MPC_6: ;6 mno
    SendInput 6
return

HPRem_MPC_7: ;7 pqrs
    SendInput 7
return

HPRem_MPC_8: ;8 tuv
    SendInput 8
return

HPRem_MPC_9: ;9 wxyz
    SendInput 9
return

HPRem_MPC_29: ;*
    SendInput *
return

HPRem_MPC_0: ;0 space
    SendInput 0
return

HPRem_MPC_22: ;Play
    ControlSend, VideoRenderer1, {space}, ahk_class MediaPlayerClassicW
return


Still, nothing happens...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 12th, 2010, 7:35 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
Hey bidomo,

I'm glad to see you're making progress!

I just want to make sure I understand your situation.
Quote:
Code:
01 01 00 00 00 32 84 0F 80 20 00 00 00                                          Visualization for XP
IR code Goes from 00 to 12 byte length (13 bytes)
01 01 00 00 00 00 00 00 00 32 84 0F 80 00 00 00 00 20 00 00 00 80 FA FF FF      Visualization for Windows 7
IR code Goes from 00 to 24 byte length (25 bytes)

That's the output from Example 2 when you press the Visualize button, I suppose?

From your edit, you say that you're now receiving 14 bytes instead of the original 25? I find it strange that you can receive different numbers of bytes by just updating AHKHID.

Anyway, I suspect that there's an error occuring somewhere, and that's why it seems like nothing happens. Try this script, while monitoring OutputDebug with something like DebugView and see if any errors pop up. It's a simplified script (no labels to call) but with error "handling" (more like error reporting). If you successfully make it to the "Data received = " part, then it's just a matter of correctly extracting the byte from uData. Post your log here.

Code:
/*
 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 12 17 18 19 20 21 22 23 24
01 01 00 00 00 00 00 00 00 32 84 0F 80 00 00 00 00 20 00 00 00 80 FA FF FF   Vizualize for Windows 7
01 01 00 00 00 32 84 0F 80 20 00 00 00                                       Vizualize for XP
*/

;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 := AHKHID_Register(65468, 137, hGui, RIDEV_INPUTSINK)

;Prefix loop
Loop {
    Sleep 1000
    If WinActive("ahk_class Winamp v1.x") Or WinActive("ahk_class Winamp EQ") Or WinActive("ahk_class Winamp PE") Or WinActive("ahk_class Winamp Gen")
        sPrefix := "Winamp"
    Else If WinActive("ahk_class MediaPlayerClassicW")
        sPrefix := "MPC"
    Else If WinActive("ahk_class eHome Render Window")
        sPrefix := "VMC"
    Else If WinActive("ahk_class MozillaUIWindowClass")
        sPrefix := "Youtube"
    Else If WinActive("ahk_class ShockwaveFlashFullScreen")
        sPrefix := "YoutubeFS"
    Else sPrefix  := "Default"
}

Return

InputMsg(wParam, lParam) {
    Local devh, iKey, uData, err
   
    Critical
   
    ;Get handle of device
    devh := AHKHID_GetInputInfo(lParam, II_DEVHANDLE)
    If (devh = -1) { ;Check for error
        OutputDebug, AHKHID_GetInputInfo failed. ErrorLevel = %ErrorLevel%
        Return
    }
   
    ;Check that it is my HP remote
    If ((err := AHKHID_GetDevInfo(devh, DI_DEVTYPE, True)) = RIM_TYPEHID)
        And ((err := AHKHID_GetDevInfo(devh, DI_HID_VENDORID, True)) = 1118)
        And ((err := AHKHID_GetDevInfo(devh, DI_HID_PRODUCTID, True)) = 109)
        And ((err := AHKHID_GetDevInfo(devh, DI_HID_VERSIONNUMBER, True)) = 272) {
       
        OutputDebug, HP remote event!
       
        ;Get the raw data received
        iKey := AHKHID_GetInputData(lParam, uData)
        If (iKey = -1) { ;Check for error
            OutputDebug, AHKHID_GetInputData failed. ErrorLevel = %ErrorLevel%
            Return
        }
       
        OutputDebug, % "Data received = " Bin2Hex(&uData, iKey)
       
        ;Extract keycode at 10th byte
        iKey := NumGet(uData, 9, "UChar")
       
        OutputDebug, % "Keycode = " iKey
       
    } Else If (err = -1) { ;Check for error
        OutputDebug, AHKHID_GetDevInfo failed. ErrorLevel = %ErrorLevel%
        Return
    }
}

;By Laszlo
;http://www.autohotkey.com/forum/viewtopic.php?p=135402#135402
Bin2Hex(addr, len) {
    Static fun
    If (fun = "") {
        h=8B54240C85D2568B7424087E3A53578B7C24148A07478AC8C0E90480F9090F97C3F6DB80E30702D980C330240F881E463C090F97C1F6D980E10702C880C130880E464A75CE5F5BC606005EC3
        VarSetCapacity(fun, 76)
        Loop 76
            NumPut("0x" . SubStr(h, 2 * A_Index - 1, 2), fun, A_Index - 1, "Char")
    }
    VarSetCapacity(hex, 2 * len + 1)
    DllCall(&fun, "uint", &hex, "uint", addr, "uint", len, "cdecl")
    VarSetCapacity(hex, -1) ;update StrLen
    Return hex
}


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 13th, 2010, 12:22 am 
Offline

Joined: December 30th, 2009, 8:03 pm
Posts: 6
Hi,

First of all thanks for very helpful information. I am able to capture all the keys from my RF MCE Remote and able to take action.

I have a problem disabling default actions though: For example the "Windows Logo Button" sends a code that I am able to get. However, it also brings the media center program in focus.

Is there a way to disable this default functionality ?

Thanks.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 13th, 2010, 12:35 am 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
justinsmith2009 wrote:
Is there a way to disable this default functionality ?

Hi justinsmith2009,
Go to the 5th step in the tutorial (second post in this thread). It'll give you all the information you need!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: rf remote
PostPosted: April 13th, 2010, 12:46 am 
Offline

Joined: December 30th, 2009, 8:03 pm
Posts: 6
Hi TheGood.

I have already tried the Step 5. I have an RF remote so that doesn't apply to me :(

Any pointers to where I can look to disable the RF Remote default actions?

Thanks.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 398 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15 ... 27  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group