AutoHotkey Community

It is currently May 27th, 2012, 1:24 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 398 posts ]  Go to page Previous  1 ... 7, 8, 9, 10, 11, 12, 13 ... 27  Next
Author Message
 Post subject:
PostPosted: January 18th, 2010, 10:51 am 
Offline

Joined: April 19th, 2007, 8:05 am
Posts: 48
Image

TheArkive, I marked the 4 buttons that can't be detected by AutoHotkey.

AHKHID can detect the 4 buttons, but all fields are 0. So can't tell which is which.

By the way, Button 4 is not "Browser_Search" on MX1100. It's a mechanical switch to toggle wheel between Freespinning/click-to-click mode. But there is a undocumented trigger inside, which indeed can serve as a button. You can't see it even in SetPoint, but AHKHID detects it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 21st, 2010, 6:36 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
bidomo wrote:
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.

Do you have the same version of AHK on XP and Win7? Even just a "MsgBox test" command doesn't execute even though the label exists? Have you tried doing some troubleshooting (like checking ErrorLevel and return values after each call to AHKHID functions and check how they differ from under XP)?

At this point, I'm not sure if it's because the Windows 7 implementation of the HID input interface has changed, or because AHKHID itself is somehow bound to XP only (by the way I coded it), or because it's something on your machine in specific. AFAIK, it shouldn't be the first one as I can't see anything on MSDN that suggests that something has changed.

I will be upgrading to Windows 7 soon, but until then, I'm not sure I can do much to help, other than to tell you to try and troubleshoot it yourself.

TiDaN wrote:
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?

Try reading through the thread again, there should be a few posts about this exact issue. One workaround (specifically for remotes) is to modify the registry. It should be a few pages down.

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

Very elegant solution! Thanks for sharing it.

TheArkive wrote:
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?

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: January 23rd, 2010, 7:05 pm 
I have an advanced weather balloon that sends back telemetry such as date, time, temperature, wind-speed, etc. There is a fairly constant stream of data streaming back that is time-stamped. Unfortunately, a cold-restart is required for proper calibration every 15-30 minutes or so. It basically means I have to run back to the machine, un-plug and re-plug the device or run a tool to handle this automatically if I want to collect data longer term.

I have found I am getting different data loss results depending on approaches to re-start the thing. I am trying to avoid the least amount of data to be lost obviously. Manually initting a cold reboot from device manager (for instance), is producing the best results so far. But this is not practical ... I would have to be standing at the computer almost continuously. I would rather be drinking tea or something.

I am curious if someone knows direct calls I can make to handle this effectively. The purpose would be to call a restart to the device... where hopefully I can re-start it in as few milliseconds as possible.

Thank you for your time & any assistance here!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2010, 12:59 pm 
Offline

Joined: May 8th, 2008, 2:58 pm
Posts: 39
Location: C:\ESTONIA\adavere\RIST.rar
can anybody tell how find averTV tv-tuner remote keys? how i search them?

_________________
Keegi Siin ka Eestlane? :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2010, 7:24 pm 
Offline

Joined: February 5th, 2009, 9:12 am
Posts: 59
Here is the code

When I press Pause in the HP remote (default profile), it gives an error message related to the default section, but in the xbox1 remote (xbox 1 remote 10th char is equal to 24 decimal, as HPRem Pause 6th byte is the same). This is really strange, I'm trying to make it work comenting the xbox1 section.

Same script in XP/Vista and latest AutoHotkey

Gonna start checking with ErrorLevel

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(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 := 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) = 1118)
        And (HID_GetDevInfo(devh, DI_HID_PRODUCTID, True) = 109)
        And (HID_GetDevInfo(devh, DI_HID_VERSIONNUMBER, True) = 272)
    {
       
        ;Get data
        iKey := HID_GetInputData(lParam, uData)
       
        ;Check for error
       
        If (NumGet(uData, 6, "UChar") = 132) or (NumGet(uData, 6, "UChar") = 4)
        {   ;IT'S THE REMOTE
            If (iKey <> -1)
            {
                ;Get keycode (located at the 6th byte)
                iKey := NumGet(uData, 5, "UChar")
               
               
                ;Set prefix
                sDevicePrefix := "HPRem"
               
                ;We're gonna have to call
                bCallEvent := True
               
            }
        }
/*
        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 Section  ######################################################################################
;######################################################################################################################

HPRem_Default_12: ;Power
    ;
return

HPRem_Default_50: ;Vizualization
    SendInput ^{esc}
return

HPRem_Default_78: ;Print
    ;
return

HPRem_Default_80: ;Radio
;;    SendInput
return

HPRem_Default_71: ;Music
;;    SendInput
return

HPRem_Default_73: ;Pictures
;;    SendInput
return

HPRem_Default_74: ;Videos
;;    SendInput
return

HPRem_Default_36: ;DVD menu
;;    SendInput
return

HPRem_Default_72: ;Recorder TV
;;    SendInput
return

HPRem_Default_38: ;Guide
;;    SendInput
return

HPRem_Default_37: ;Live TV
;;    SendInput
return

HPRem_Default_39: ;Aspect
;;    SendInput
return

HPRem_Default_51: ;slideShow
;;    SendInput
return

HPRem_Default_15: ;More info
;;    SendInput
return

HPRem_Default_30: ;Up
;;    SendInput
return

HPRem_Default_32: ;Left
;    SendInput
return

HPRem_Default_34: ;Ok
;    SendInput
return

HPRem_Default_33: ;Right
;    SendInput
return

HPRem_Default_31: ;Down
;    SendInput
return

HPRem_Default_35: ;Back
;    SendInput
return

HPRem_Default_16: ;Volume +
;    SendInput
return

HPRem_Default_13: ;Green Button
;    SendInput
return

HPRem_Default_18: ;Channel +
;    SendInput
return

HPRem_Default_17: ;Volume -
;    SendInput
return

HPRem_Default_14: ;Mute
;    SendInput
return

HPRem_Default_19: ;Channel -
;    SendInput
return

HPRem_Default_23: ;Record
    ;Run, E:\Remote CMDs\MicMute.exe
return

HPRem_Default_52: ;Eject
    ;Run, E:\Remote CMDs\LineInMute.exe
return

HPRem_Default_21: ;Rewind
;    SendInput
return

HPRem_Default_22: ;Play
;    SendInput
return

HPRem_Default_24: ;Pause
;    SendInput
return

HPRem_Default_20: ;Forward
;    SendInput
return

HPRem_Default_27: ;Skip <<-
;    SendInput
return

HPRem_Default_25: ;Stop
;    SendInput
return

HPRem_Default_26: ;Skip ->>
;    SendInput
return

HPRem_Default_1: ;1 Symbols
    SetKeyDelay, 0, 50
    ControlSend, VideoRenderer1, {space}, ahk_class MediaPlayerClassicW
return

HPRem_Default_2: ;2 abc
;    SendInput
return

HPRem_Default_3: ;3 def
;    SendInput
return

HPRem_Default_4: ;4 ghi
;    SendInput
return

HPRem_Default_5: ;5 jkl
;    SendInput
return

HPRem_Default_6: ;6 mno
;    SendInput
return

HPRem_Default_7: ;7 pqrs
;    SendInput
return

HPRem_Default_8: ;8 tuv
;    SendInput
return

HPRem_Default_9: ;9 wxyz
;    SendInput
return

HPRem_Default_29: ;*
;    SendInput
return

HPRem_Default_0: ;0 space
;    SendInput
return

HPRem_Default_28: ;#
;    SendInput
return

HPRem_Default_10: ;Clear
;    SendInput
return

HPRem_Default_11: ;Enter
;    SendInput
return

;######################################################################################################################
;#######  HPRem_vmc Section  ##########################################################################################
;######################################################################################################################

HPRem_VMC_1: ;1 Symbols
    Sendinput 1
return

HPRem_VMC_2: ;2 abc
    SendInput 2
return

HPRem_VMC_3: ;3 def
    SendInput 3
return

HPRem_VMC_4: ;4 ghi
    SendInput 4
return

HPRem_VMC_5: ;5 jkl
    SendInput 5
return

HPRem_VMC_6: ;6 mno
    SendInput 6
return

HPRem_VMC_7: ;7 pqrs
    SendInput 7
return

HPRem_VMC_8: ;8 tuv
    SendInput 8
return

HPRem_VMC_9: ;9 wxyz
    SendInput 9
return

HPRem_VMC_29: ;*
    SendInput *
return

HPRem_VMC_0: ;0 space
    SendInput 0
return

;######################################################################################################################
;#######  HPRem_MPC Section  ##########################################################################################
;######################################################################################################################
HPRem_MPC_1: ;1 Symbols
;    SetKeyDelay, 0, 50
;    ControlSend, VideoRenderer1, ^{Left}, ahk_class MediaPlayerClassicW
return

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

HPRem_MPC_3: ;3 def
    ControlSend, VideoRenderer1, ^{right}, ahk_class MediaPlayerClassicW
return

HPRem_MPC_4: ;4 ghi
    ControlSend, VideoRenderer1, ^{enter}, ahk_class MediaPlayerClassicW
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_Winamp Section  #######################################################################################
;######################################################################################################################

HPRem_Winamp_1: ;1 Symbols
    Sendinput 1
return

HPRem_Winamp_2: ;2 abc
    SendInput 2
return

HPRem_Winamp_3: ;3 def
    SendInput 3
return

HPRem_Winamp_4: ;4 ghi
    SendInput 4
return

HPRem_Winamp_5: ;5 jkl
    SendInput 5
return

HPRem_Winamp_6: ;6 mno
    SendInput 6
return

HPRem_Winamp_7: ;7 pqrs
    SendInput 7
return

HPRem_Winamp_8: ;8 tuv
    SendInput 8
return

HPRem_Winamp_9: ;9 wxyz
    SendInput 9
return

HPRem_Winamp_29: ;*
    SendInput *
return

HPRem_Winamp_0: ;0 space
    SendInput 0
return

;######################################################################################################################
;#######  HPRem_Youtube Section  ######################################################################################
;######################################################################################################################

HPRem_Youtube_1:
    Send, {browser_back}
return

HPRem_Youtube_2:
    MouseMove, 0, -10, 0, R

return

HPRem_Youtube_3:
    MouseClick, left,  786,  624
    MouseMove, -100, -200, 0, R
return

HPRem_Youtube_4:
    MouseMove, -10, 0, 0, R  ; Move cursor to the left
return

HPRem_Youtube_5:
    SendEvent {Blind}{LButton down}
    KeyWait, Enter ; Prevents keyboard auto-repeat from repeating the mouse click.
    SendEvent {Blind}{LButton up}
return

HPRem_Youtube_6:
    MouseMove, 10, 0, 0, R
return

HPRem_Youtube_7: ; 6
    SendInput {space}
return

HPRem_Youtube_8: ;8 tuv
    MouseMove, 0, 10, 0, R  ; Move cursor downward
return

HPRem_Youtube_9: ;9 wxyz
    SendEvent {Blind}{RButton down}
    KeyWait, Enter ; Prevents keyboard auto-repeat from repeating the mouse click.
    SendEvent {Blind}{RButton up}
return

HPRem_Youtube_29: ;*
    sendinput {down}
return

HPRem_Youtube_0: ;0 space
    sendinput {F5}
return

;######################################################################################################################
;#######  HPRem_YoutubeFS Section  ####################################################################################
;######################################################################################################################

HPRem_YoutubeFS_1:
    Send, {browser_back}
return

HPRem_YoutubeFS_2:
    MouseMove, 0, -10, 0, R

return

HPRem_YoutubeFS_3:
    MouseClick, left,  786,  624
    MouseMove, -100, -200, 0, R
return

HPRem_YoutubeFS_4:
    MouseMove, -10, 0, 0, R  ; Move cursor to the left
return

HPRem_YoutubeFS_5:
    SendEvent {Blind}{LButton down}
    KeyWait, Enter ; Prevents keyboard auto-repeat from repeating the mouse click.
    SendEvent {Blind}{LButton up}
return

HPRem_YoutubeFS_6:
    MouseMove, 10, 0, 0, R
return

HPRem_YoutubeFS_7: ; 6
    SendInput {space}
return

HPRem_YoutubeFS_8: ;8 tuv
    MouseMove, 0, 10, 0, R  ; Move cursor downward
return

HPRem_YoutubeFS_9: ;9 wxyz
    SendEvent {Blind}{RButton down}
    KeyWait, Enter ; Prevents keyboard auto-repeat from repeating the mouse click.
    SendEvent {Blind}{RButton up}
return

HPRem_YoutubeFS_29: ;*
    sendinput {down}
return

HPRem_YoutubeFS_0: ;0 space
    sendinput {up}
return

;######################################################################################################################
;#######  HPRem_Default Section  ######################################################################################
;######################################################################################################################


XBOX1_Default_42: ;Display
    Send, e
return

XBOX1_Default_29: ;Reverse
;    SendInput
return

XBOX1_Default_21: ;Play
;    SendInput
return

XBOX1_Default_28: ;Forward
;    SendInput
return

XBOX1_Default_34: ;Skip -
;    SendInput
return

XBOX1_Default_31: ;Stop
;    SendInput
return

XBOX1_Default_25: ;Pause
;    SendInput
return

XBOX1_Default_32: ;Skip +
;    SendInput
return

XBOX1_Default_26: ;Title
;    SendInput
return

XBOX1_Default_89: ;Up
;    SendInput
return

XBOX1_Default_60: ;Info
;    SendInput
return

XBOX1_Default_86: ;Left
;    SendInput
return

XBOX1_Default_244: ;Select
;    SendInput
return

XBOX1_Default_87: ;Right
;    SendInput
return

XBOX1_Default_8: ;Menu
;    SendInput
return

XBOX1_Default_88: ;Down
;    SendInput
return

XBOX1_Default_39: ;Back
;    SendInput
return

XBOX1_Default_49: ;1
;    SendInput
return

XBOX1_Default_50: ;2
;    SendInput
return

XBOX1_Default_51: ;3
;    SendInput
return

XBOX1_Default_52: ;4
;    SendInput
return

XBOX1_Default_53: ;5
;    SendInput
return

XBOX1_Default_54: ;6
;    SendInput
return

XBOX1_Default_55: ;7
;    SendInput
return

XBOX1_Default_56: ;8
;    SendInput
return
/*
XBOX1_Default_57: ;9
;    SendInput
return
*/
XBOX1_Default_48: ;0
    SetKeyDelay, 0, 50
    ControlSend, VideoRenderer1, {space}, ahk_class MediaPlayerClassicW
    ;ControlSend, , {bs}, ahk_class eHome Render Window
    ;send {vk176}
return



not even your original remote script works, so I'm guessing is the way 7 handles AHK, HID works, but in a script totally unrelated to AHKHID, I have so many trouble with ControlSend.

Update: Already tried with ErrorLevel, and noticed the code is not even reaching its destination (trying with MPC), so, the problem for windows 7 relays in the search of the remote code, don't really know where but it has something to do with the byte we're searching for in the remote.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 5th, 2010, 5:28 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
OK, I updated AHKHID so that the functions are all named with the prefix AHKHID_. This way, you can put AHKHID.ahk in your library folders. Not sure why I didn't do that in the first place! I updated the Examples accordingly (and added a few minor improvements).

I also added a section to the tutorial to explain how to disable/modify the original function of remote buttons. See it here.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2010, 1:04 am 
hi theGood,

this is ...completely awesome...thank you so much!

i do have one question though (i will try this tonight), based on your original post, does this mean if you cannot disable the functions of your original remote, having AHKHID won't help either?

The reason I looked into this is because i have exactly this problem. I currently use EG to map an HID command of my remote to another function. HOwever, i have been unable to actually stop the same HID command from reaching other programs.

If as you say I cannot disable this because i am not an RC5 MCE remote, does this mean i will still be helpless in this situation?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2010, 1:13 am 
hi theGood,

sorry I think I may have mis-understood you..but please correct me if i am wrong..

if a button on my remote has a conflicting function... i could do one of the following 2 things.

a. disable the particular function (if applicable) through the hidir registry.
b. employ the AHKHID scripts.

It sounds like the AHKHID scripts will stop whatever function button in its tracks and thus preventing any program or OS from reacting to it.

Does this sound about right? Sorry I'm a serious newb...

thanks!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2010, 5:59 am 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
defender013 wrote:
It sounds like the AHKHID scripts will stop whatever function button in its tracks and thus preventing any program or OS from reacting to it.

No. AHKHID can't do anything to stop the key's original function to go off.

You basically have three options if you want to stop keypresses, depending on which category you fit in:
  • If it shows up as a remote, you can use the registry trick I just added in the tutorial.
  • If it does not show up as a remote, but does show up in the Other tab whose TLC when registered allows you to capture all the keys, then you can try uninstalling the keyboard. I go through the steps here.
  • If it does not show up as a remote or as a device in the Other tab, but as a keyboard only, then you can try registering the keyboard TLC (UsPg 1 and Us 6) and filter the relevant keypresses. Look here for a sample script on how to do that. Don't look at the second method I posted in that post, it doesn't work.
Hope this clears things up! I'll add this information on the main post as well since it seems to be a recurring question.

Edit: OK, I added this information on the main post.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2010, 10:30 am 
Hi theGood,

thank you...for your incredibly detailed and organized response, truly, you are a great help and savior to many. Many thanks for your time and effort.

I will definitely give your suggestions a try, since I am interested to see what I'll find out.

On a side note, I temporarily worked around the problem I was having by going into the program register of the problematic program and disabled MultiMediaKeyBoard. So the buttons are still generated, but the program no longer responds to them. Although...I really hate having to hack registry this way, I will try out un-installing the keyboard driver.

One question though, I'm not sure if you are familiar with Eventghost, but I'm assuming by un-installing the keyboard, I will effectively dis-allow eventghost from recognizing the events, although AHKHID should still be able to recognize the raw data.

If I understand correctly, in general, is this how the flow works?

HID-DEVICE generates raw input stream -> binds to some registry value to create keyboard event -> causes a response in the system

From what I know, eventghost comes in after the keyboard event, but AHKHID has the ability to come in prior (but it cannot stop the keyboard event), is this correct? (sorry for so many questions, but I would love to come out of this whole exercise with at least some understanding of how this whole thing works in general).

Many thanks,
defender013


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2010, 5:16 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
defender013 wrote:
One question though, I'm not sure if you are familiar with Eventghost, but I'm assuming by un-installing the keyboard, I will effectively dis-allow eventghost from recognizing the events, although AHKHID should still be able to recognize the raw data.

It all depends on if Eventghost is relying on keyboard presses or on the HID interface (the same one AHKHID uses), in which case it is at exactly the same "level" as AHKHID.

I took a quick look at the program's webpage and it definitely looks like it would register the remote's TLC, so I don't think blocking the keyboard events will do anything. Still worth a try, I guess. Your best bet would be configuring the program, as you did already.

defender013 wrote:
If I understand correctly, in general, is this how the flow works?

HID-DEVICE generates raw input stream -> binds to some registry value to create keyboard event -> causes a response in the system

To tell you the truth, I'm not 100% sure. Definitely not all HID devices have mappings in the registry. Some are coded in the device driver itself.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: button release problems
PostPosted: March 25th, 2010, 9:13 am 
Offline

Joined: March 25th, 2010, 8:57 am
Posts: 9
I'm trying to handle my tablet pc's buttons and to implement an autorepeat using a timer. It works, except that sometimes a "button off" event never appears, so my autorepeat keeps repeating after the button is released.

Here is some data from the device:
Code:
0120000000
0100000000  <-- off
0104000000
0100000000  <-- off
0120000000
0130000000
0120000000
0100000000  <-- off
0104000000
010C000000
0104000000
0100000000  <-- off
0104000000
0100000000  <-- off
0120000000
0100000000  <-- off
0104000000  <-- on, without a following off, even after I have released the button


I had the same problem when I implemented this using AutohotkeyRemoteControl.dll. Any ideas? Is there a way to poll AHKHID about the state of the device, rather than to always just wait for it to generate an event?


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 25th, 2010, 3:46 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
Maiklas3000 wrote:
Is there a way to poll AHKHID about the state of the device, rather than to always just wait for it to generate an event?

You seem to have figured out the issue rather well. Unfortunately, AHKHID cannot poll for a device's state, not because I haven't implemented it, but because it's not possible to do so with the raw input APIs that AHKHID wraps. The interface is 100% event-driven, through the reception of WM_INPUT messages.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2010, 12:59 pm 
Offline

Joined: March 25th, 2010, 8:57 am
Posts: 9
When I use the Tablet PC Settings to assign a key press to a button, it has no problems with repeating. So I guess I should use that or a registry edit. For example, I could map a button to ctrl-alt-5, and then use AHK to map that to an action. But this brings up the possibility of conflicts with existing hotkeys, which is why I tried to use AHKHID. Can anyone point to some good (rarely used) key combinations to use?

Maybe AHKHID would miss less keypresses/releases if the speed were improved in the critical part? Maybe it could do the minimum necessary to stick each event onto a buffer, which would be handled by another thread?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2010, 5:56 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
Maiklas3000 wrote:
When I use the Tablet PC Settings to assign a key press to a button, it has no problems with repeating. So I guess I should use that or a registry edit. For example, I could map a button to ctrl-alt-5, and then use AHK to map that to an action. But this brings up the possibility of conflicts with existing hotkeys, which is why I tried to use AHKHID. Can anyone point to some good (rarely used) key combinations to use?

I find that good hotkeys to use in these situations are the ones that start with Ctrl+Alt+Shift+Win. Then you can use number keys or function keys to complete the hotkey.

Maiklas3000 wrote:
Maybe AHKHID would miss less keypresses/releases if the speed were improved in the critical part? Maybe it could do the minimum necessary to stick each event onto a buffer, which would be handled by another thread?

You bring up a very good point. I only learned recently (while working on another project) that messages are not buffered if the message < 0x312 and the function handling the message isn't done processing.

AutoHotkey Help wrote:
By contrast, a message less than 0x312 cannot be buffered by Critical or Thread Interrupt (however, in v1.0.46+, Critical may help because it checks messages less often, which gives the function more time to finish). The only way to guarantee that no such messages are missed is to ensure the function finishes in under 6 milliseconds (though this limit can be raised via Critical 30). One way to do this is to have it queue up a future thread by posting to its own script a monitored message number higher than 0x312. That message's function should use Critical as its first line to ensure that its messages are buffered.

Note that the posting workaround mentioned doesn't work for AHKHID because the handle (contained in lParam) expires by the time the message is actually processed.

I will think up of something for you to see if this is indeed the situation. Note that I have yet (at least, I don't think so) to encounter a device that generates so many WM_INPUT to cause a loss of data., so I'm kind of troubleshooting in the dark here. In the meantime, you can try doing what the AHK Help says and see if Critical 30 (or higher) helps.


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 ... 7, 8, 9, 10, 11, 12, 13 ... 27  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, Yahoo [Bot] and 13 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