AutoHotkey Community

It is currently May 27th, 2012, 6:25 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 398 posts ]  Go to page Previous  1 ... 18, 19, 20, 21, 22, 23, 24 ... 27  Next
Author Message
 Post subject:
PostPosted: February 13th, 2011, 1:28 pm 
It was just this yes.

I used example 1, I saw there 2 mice, one with 2 buttons and a sample rate of 60 and the other one, probably the real one, with 5 buttons and a sample rate of 0. With example 2 and 3 I pushed every buttons on the mouse and unfortunately only clicks and wheel are recognized, does it mean that there is nothing I can do despite this button can wake up the computer ? By the way this mouse is driverless, it's just customized by a software that is launched only when needed.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2011, 4:38 pm 
Offline

Joined: January 15th, 2007, 2:37 pm
Posts: 573
I'd say it's likely that you should be able to use it with AHK, but I am not an expert. Are you saying that the button is not seen as a mouse? If so look and see if it's seen in "Other HID Devices".

I won't be online again until this evening. If you have questions before then you might want to try asking in the help section.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2011, 5:23 pm 
I looked in "other" and there there is 2 things that use UP12 and U1, I looked and it's just "Consumer control device according to Human Interface Devices" (google translation) and just in case I entered this in example 2 and I get nothing using the keyboard or mouse.

I don't know as what this button is seen as, if it's at least seen, all I saw is that my mouse is detected as 5 buttons and pushing the buttons other than clicks and wheel doesn't do anything except if I binded them to something using the software (but I can't bind this button to anything as said before).


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2011, 12:41 am 
Offline

Joined: February 5th, 2009, 9:12 am
Posts: 59
There's a problem in AHKHID, or the remote script.

A while ago, TheGood made some changes to the Example remote script for me to test in Win7 x67 (which now works almost flawlesly wit AHK_L x64).
It was modified so it will make some code corrections and point to a new bit within the remote output, and it will give output debug feedback

the code is as follows.
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
}


If you look closely, there's an include for ahkhid.ahk within the code
Code:
#Include %A_ScriptDir%\AHKHID.ahk

If I move AHKHID.AHK to the Lib\ forlder, it will stop working, will not even give the output debug, of course, I'm commenting that include
Code:
;#Include %A_ScriptDir%\AHKHID.ahk


So now, for it to work I have to include the file from the Lib\ folder.

I think this could lead to trouble in some other scripts using this library.


BY THE WAY: Notice the AHKHID examples does not #include the library anymore, but still works.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2011, 7:59 am 
Offline

Joined: February 7th, 2009, 5:37 am
Posts: 43
bidomo
AHKHID Documentation - TheGood wrote:
USING THE CONSTANTS:

If you explicitly #include AHKHID in your script, you will have all the constants available to you. Otherwise, if AHKHID is
in your library folder and you do not wish to explicitly #include it, you can call AHKHID_UseConstants() to have the
constants available to you.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2011, 6:08 pm 
Offline

Joined: February 5th, 2009, 9:12 am
Posts: 59
Big Digger wrote:
bidomo
AHKHID Documentation - TheGood wrote:
USING THE CONSTANTS:

If you explicitly #include AHKHID in your script, you will have all the constants available to you. Otherwise, if AHKHID is
in your library folder and you do not wish to explicitly #include it, you can call AHKHID_UseConstants() to have the
constants available to you.


Damn, I really never came across that, but thanks for clarifying it for me...
Now I'm gonna take some reading lessons

EDIT::

Some time ago I posted some stuff about the ReportMappingTable and stuff to disable the default Remote behavior. Seems like it does not work on win 7 anymore, vista did.

Deleting CodeSetNum0..3 or filling ReportMappingTable to 00 00 00 (not touching the remote keycodes, obviously), will not even let the Example 2 script to get any input from the remote.

The only buttons declared in the ReportMappingTable and those which uses WM_INPUT will give something to Example 2.

Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HidIr\Remotes\745a17a0-74d3-11d0-b6fe-00a0c90f57da]
"ReportMappingTable"=hex:\
;########################################################################################################
; Power, Vizualization, Print, Radio, Music, Pictures, Videos
  0c,00,00,00,04,09,2b,\   ;12 Power
  32,00,00,00,04,08,45,\   ;50 Vizualization
  4e,00,00,00,04,08,08,\   ;78 Print
;  50,00,00,00,00,00,00,\   ;80 Radio
;  47,00,00,00,00,00,00,\   ;71 Music
;  49,00,00,00,00,00,00,\   ;73 Pictures
;  4A,00,00,00,00,00,00,\   ;74 Videos
;########################################################################################################
; DVD Menu, Recorded TV, Guide, Live TV, Aspect, Slide show, More Info, Back
  24,00,00,00,00,00,00,\   ;36 DVD Menu
  48,00,00,00,00,00,00,\   ;72 Recorded TV
  26,00,00,00,00,00,00,\   ;38 Guide
  25,00,00,00,00,00,00,\   ;37 Live TV
  27,00,00,00,00,00,00,\   ;39 Aspect
  33,00,00,00,00,00,00,\   ;51 SlideShow
  0f,00,00,00,00,00,00,\   ;15 More Info
  23,00,00,00,00,00,00,\   ;35 Back
;########################################################################################################
; Up, left, Ok, Right, Down
  1e,00,00,00,00,00,00,\   ;30 Up
  20,00,00,00,00,00,00,\   ;32 Left
  22,00,00,00,00,00,00,\   ;34 OK
  21,00,00,00,00,00,00,\   ;33 Right
  1f,00,00,00,00,00,00,\   ;31 Down
;########################################################################################################
; Volume +, Volume -, Channel +, Channel -, TGB, Mute
  10,00,00,00,00,00,00,\   ;16 Vol +
  11,00,00,00,00,00,00,\   ;17 vol -
  12,00,00,00,00,00,00,\   ;18 chan+
  13,00,00,00,00,00,00,\   ;19 chan-
  0d,00,00,00,00,00,00,\   ;13 TGB
  0e,00,00,00,00,00,00,\   ;14 mute
;########################################################################################################
; Record, Eject, Rewind, Play, Pause, Forward, Replay, Stop, Skip
  17,00,00,00,00,00,00,\   ;23 Record
  34,00,00,00,00,00,00,\   ;52 eject
  15,00,00,00,00,00,00,\   ;21 rewind
  16,00,00,00,00,00,00,\   ;22 play
  18,00,00,00,00,00,00,\   ;24 Pause
  14,00,00,00,00,00,00,\   ;20 forward
  1b,00,00,00,00,00,00,\   ;27 Replay / skip <<--
  19,00,00,00,00,00,00,\   ;25 Stop
  1a,00,00,00,00,00,00,\   ;26 Skip / slip -->>
;########################################################################################################
; 0-9                                    27, 1e, 1f, 20, 21, 22 , 23, 24, 25, 26
  00,00,00,00,00,00,00,\   ;0
  01,00,00,00,00,00,00,\   ;1
  02,00,00,00,00,00,00,\   ;2
  03,00,00,00,00,00,00,\   ;3
  04,00,00,00,00,00,00,\   ;4
  05,00,00,00,00,00,00,\   ;5
  06,00,00,00,00,00,00,\   ;6
  07,00,00,00,00,00,00,\   ;7
  08,00,00,00,00,00,00,\   ;8
  09,00,00,00,00,00,00,\   ;9
;########################################################################################################
; *, #, CLEAR, ENTER
  1d,00,00,00,00,00,00,\   ;29 *
  1c,00,00,00,00,00,00,\   ;28 #
  0a,00,00,00,00,00,00,\     ;10 Clear
  0b,00,00,00,00,00,00      ;11 Enter


in this ReportMappingTable, only the first 7 buttons in the Remote will give something to the AHKHID Example 2;
Power: I assigned this button a keyboard event directly to the registry, Ctrl + Win +Tab
Visualization: it has Ctrl + F12
Print: it has Win + E
Radio, Music, Pictures & Videos: although disabled, they don't originally appear in the mapping table, but they still work because they use WM_INPUT.

The rest of the list does not give anything.

Any help will be appreciated.

.::EDIT::.

Already Solved it!

You have to use at least a single button assign in the ReportMappingTable and leave the rest of the buttons alone, they will still give feedback to the IR receiver

Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HidIr\Remotes\745a17a0-74d3-11d0-b6fe-00a0c90f57da]
"ReportMappingTable"=hex:\
;########################################################################################################
; Power, Vizualization, Print, Radio, Music, Pictures, Videos
  0c,00,00,00,04,09,2b   ;12 Power   which sends Ctrl + Win + Tab


If anyone has this remote http://mediacenterguides.com/sites/default/files/hp_remote.jpg (tried to resize it within the BB code but didn't work), working in XP and vista, please, send me the registry codes to keep looking into this (I don't have a XP or vista machine anymore, my actual PC does not like XP).


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: not quite getting it
PostPosted: February 27th, 2011, 9:30 pm 
Offline

Joined: December 2nd, 2010, 12:25 am
Posts: 73
Location: Ontario, Canada
cracksloth wrote:
finally, this could be made much simpler for me if AHKHID could distinguish using:
Code:
And (AHKHID_GetDevInfo(devh, DI_KBD_NUMBEROFKEYSTOTAL, True) = 110)

because my remote reports a different number of keys than my keyboard. unfortunately, this does not seem to work for me. can anyone else distinguish using that criteria?

any thoughts are certainly welcome (especially TheGood's if he is still around).


-cs



This is What I came up with so far.
Code:
/*!
Snapstream firefly mini remote

Rewind      6
Pause      10
Foward      5
Previous   8
Play      4
Next      7
Record      11
Guide      20
Stop      9
Menu      15
Option      27
Last      1
Exit      24
Red Button   16
Vol Down   14
Vol UP      13
CH Down      3
Ch Up      2
Mute      17
Close      26


Virtual Keys
Button  Vkey
0       48
1       49
2       50
3       51
4       52
5       53
6       54
7       55
8       56
9       57
Left    370
Right   39
Up      38             
Down    40
OK      13             
Close   17

*/

#SingleInstance

;Must be in auto-execute section if I want to use the constants
#Include 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(12, 1, hGui, RIDEV_INPUTSINK )

; Register Keyboard input and pass through keys from keyboard input
k := AHKHID_Register(1, 6, 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 Winamp v1.x") Or WinActive("ahk_class Winamp Video")
        sPrefix := "Winamp"
    Else If WinActive("ahk_class MediaPlayerClassicW")
        sPrefix := "MPC"
    Else sPrefix := "Default"
}

Return

InputMsg(wParam, lParam, msg, hwnd) {
    Local devh, iKey, sLabel, r ,vKey
   
     
    Critical
   ;Get device type
    r := AHKHID_GetInputInfo(lParam, II_DEVTYPE)
       
   
     If (r = RIM_TYPEKEYBOARD) {
        ;Get handle of device
        devh := AHKHID_GetInputInfo(lParam, II_DEVHANDLE)
        iKeyCount := AHKHID_GetDevInfo(devh, DI_KBD_NUMBEROFKEYSTOTAL, True)
        ; Firefly remote shows as 264 keys so we will take advantage of that ot isolate
        ; the remote only keyboard input
        if (iKeycount > 0 && iKeyCount = 264) {
           ; OutputDebug, got it now
            vKey := AHKHID_GetInputInfo(lParam, II_KBD_VKEY)
            ;Call the appropriate sub if it exists
                sLabel := sPrefix "__" vKey
                If IsLabel(sLabel)
                    Gosub, %sLabel%
               
            return
        }
    } Else If (r = RIM_TYPEHID) {
        ;Get handle of device
        devh := AHKHID_GetInputInfo(lParam, II_DEVHANDLE)
        If (devh <> -1) ;Check that it is my Firefly Mini
        And (AHKHID_GetDevInfo(devh, DI_DEVTYPE, True) = RIM_TYPEHID)
        And (AHKHID_GetDevInfo(devh, DI_HID_VENDORID, True) = 4659)
        And (AHKHID_GetDevInfo(devh, DI_HID_PRODUCTID, True) = 57351)
        And (AHKHID_GetDevInfo(devh, DI_HID_VERSIONNUMBER, True) = 256) {
       
            ;Get data
            iKey := AHKHID_GetInputData(lParam, uData)

            ;Check for error
            If (iKey <> -1) {
               
                ;Get keycode (located at the 2nd byte)
                iKey := NumGet(uData, 1, "UChar")

                ;Call the appropriate sub if it exists
                sLabel := sPrefix "_" iKey
                If IsLabel(sLabel)
                    Gosub, %sLabel%
            }
        }
    }
   
}



x::
ExitApp


VLC_20:
return
VLC__48:
    SendInput {Space}
    sleep 500
return

VLC_15: ;Menu
    SendInput f ;Toggle fullscreen
Return

VLC_2: ;Channel Up
    SendInput ^{Up}
Return

VLC_3: ;Channel Down
    SendInput ^{Down}
Return

VLC_6: ;Rewind
    SendInput !{Left}
Return

VLC_8: ;Previous Track
    SendInput p
Return

VLC_4: ;Play
    SendInput q
Return

VLC_10: ;Pause
    SendInput {Space}
    sleep 1000
Return

VLC_9: ;Stop
    SendInput s
Return

VLC_5: ;Forward
    SendInput !{Right}
Return

VLC_7: ;Next Track
    SendInput n
Return

MPC_15: ;More
    SendInput !{Enter} ;Toggle fullscreen
Return

MPC_2: ;Channel Up
    SendInput {Up}
Return

MPC_3: ;Channel Down
    SendInput {Down}
Return

MPC_6: ;Rewind
    SendInput !{Left}
Return

MPC_5: ;Forward
    SendInput !{Right}
Return

MPC_8: ;Previous Track
    SendInput !{End}
Return

MPC_7: ;Next Track
    SendInput !{Home}
Return

MPC_4: ;Play
    SendInput !p
Return

MPC_10: ;Pause
    SendInput {Space}
Return

MPC_9: ;Stop
    SendInput !s
Return


I Am still in the testing phase but was able to distingush between keyboard using:
"iKeyCount := AHKHID_GetDevInfo(devh, DI_KBD_NUMBEROFKEYSTOTAL, True)" and "if (iKeycount > 0 && iKeyCount = 264)"

The issue I am having now is that the remote is sill triggering the the keypress with the system. Of course this sometimes causes conflicts with vlc etc.

I tried modifying the "ReportMappingTable" in "745a17a0-74d3-11d0-b6fe-00a0c90f57da" of the "Remote" section of the registry but it had no affect. I modifed is as recommended by the post above.

Anyone got around this issue?

I am using Win7 x64 Sp1 and AutoHotkey Version v1.0.48.05.L61 x64


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2011, 12:55 am 
Offline

Joined: February 5th, 2009, 9:12 am
Posts: 59
device and vendor ID in your remote do not match to the one I have, is very likely the registry entry you need to modify i different, below, there's like 5 other keys

Code:
745a17a0-74d3-11d0-b6fe-00a0c90f57da                            RC6 based MCE remote
745a17a0-74d3-11d0-b6fe-00a0c90f57db                            Samsung MCE remote
745a17a0-74d3-11d0-b6fe-00a0c90f57dc                            MCIR Standard Keyboard Remote
745a17a0-74d3-11d0-b6fe-00a0c90f57dd                            MCIR Japanese Keyboard Remote
745a17a0-74d3-11d0-b6fe-00a0c90f57de                            MCIR Three Button Mouse Remote
b1c84016-5174-4894-8e49-b3e8dbe06bbb                             QuatroPulse MCE remote


Also, some other remotes may relay in a service or background program.
and depending in the usage, it will report the keycodes in a diferent way.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 1st, 2011, 2:39 am 
Offline

Joined: December 2nd, 2010, 12:25 am
Posts: 73
Location: Ontario, Canada
I create another example of using AHKHID. This example allows a Microsoft Sidewinder Joystick to be used.

you can find the post here

Thanks for the tools and all your hard work guys.
Great Stuff!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: AHKHID.AHK crahses
PostPosted: March 7th, 2011, 11:38 pm 
Offline

Joined: March 7th, 2011, 7:57 pm
Posts: 16
Not sure what I'd doing wrong here, but I can't get AHKHID.AHK to run. I see the AHK icon pop up in the tray for a brief second and then the script just crashes.

I've had no issues running other scripts. I tried both the normal and 64-bit scripts, along with the basic autohotkey and auothotkey_L. I'm running windows 7 64-bit.

Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2011, 11:48 pm 
Offline

Joined: February 5th, 2009, 9:12 am
Posts: 59
AHKHID is not meant to be directly running, is a library for HID devices, that might be why it's crashing, you need some of the examples, like the remote, which I been using for a while.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2011, 12:00 am 
Offline

Joined: March 7th, 2011, 7:57 pm
Posts: 16
New here, so please be patient.... I'm not sure I follow "need some of the examples, like the remote, which I been using for a while." Remorte?

Do I put AHKHID.AHK in the same folder as the scripts, and then run a different script, and then run the example scripts for AHKHID.AHK? Sorry for being daft....


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2011, 12:06 am 
Offline

Joined: February 5th, 2009, 9:12 am
Posts: 59
Please, read the very first page in this thread, there's a lot of info there.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2011, 12:25 am 
Offline

Joined: March 7th, 2011, 7:57 pm
Posts: 16
I figured it out... for some reason it wasn't working before, hence my confusion. thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2011, 12:35 pm 
Offline

Joined: March 8th, 2011, 12:20 pm
Posts: 4
seems that this HID-related scripting might be able to do what I need.
Could you please support with this a bit?

Can you distinguish if a keypress came from a netbook's/UMPC's internal keyboard or a keyboard attached to the USB port?
I'd like to implment some hotkeys and hotstrings only for the built-in keyboard, but not for an external one...

Thanks!
Daniel


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 ... 18, 19, 20, 21, 22, 23, 24 ... 27  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, Bing [Bot], JamixZol, rbrtryn, Stigg, Yahoo [Bot] and 27 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