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...