AutoHotkey Community

It is currently May 26th, 2012, 6:37 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 398 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 27  Next
Author Message
 Post subject:
PostPosted: June 13th, 2009, 10:19 am 
Offline

Joined: February 5th, 2009, 9:12 am
Posts: 59
I like AHKHID for my remote that much, I refuse to not use it! Thanks for AHKHID.

The Play and pause buttons should be separated for MCE, allows me to remove the playback OSD (pressing play twice, and I get my Thumb workout too!!!), unless I find a nice replacement for MCE (tried a lot of them, but MCE stills ahead), and if some other Software convinces me, MCE will have to pray for his life (and bye to my badass thumb...).

I will be digging a lot more in my free time.


Forgot to say, ControlSend doesn't work with MCE, and I don't see how PostMessage can help, as I get nothing from winspector, and that's how I found that info, thanks to failure.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 15th, 2009, 3:41 pm 
Offline

Joined: March 8th, 2009, 12:30 am
Posts: 9
In another words, how do you disable the original key presses of the MCE remote such as 0-9 numbers and replace them?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2009, 4:27 pm 
Hi,
i don't know if this is the right place to ask for, but i need help.
I want to intercept the press of special keys on my Media center remote controller (as the red, green, yellow and blue keys), and use them in a autohotkey script. Is it possible? And how?

Thank you.

Bye.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2009, 5:34 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
bidomo wrote:
Forgot to say, ControlSend doesn't work with MCE, and I don't see how PostMessage can help, as I get nothing from winspector, and that's how I found that info, thanks to failure.

Can't you use SendInput? Or is the MCE interface not always in the foreground? I don't see why ControlSend shouldn't work. Did you check with Winspector to make sure that MCE receives the keys sent by ControlSend? Try also doing (for example if you're trying to send the A key):
Code:
        Send {a Down}
        Sleep 50
        Send {a Up}


bxr wrote:
In another words, how do you disable the original key presses of the MCE remote such as 0-9 numbers and replace them?

Look here. :)
And here's the relevant section:
Quote:
On the other hand, if you do end up finding an entry in the Other section of Example 1, then you can make the remote stop generating those keyboard presses by doing the following steps:
1. Go to Device Manager
2. Expand the "Keyboards" tree
3. You should find a device (ie. your remote registered as a keyboard) other than your usual keyboard there. To make sure it is indeed your remote, you can compare the name you found in Example 1 with the name you'll find when you right-click>Properties>Details on the keyboard item in Device Manager.
4. Once you found the keyboard entry associated to your Kensington Presentation remote, right-click the item and select Uninstall


MonsterMash wrote:
Hi,
i don't know if this is the right place to ask for, but i need help.
I want to intercept the press of special keys on my Media center remote controller (as the red, green, yellow and blue keys), and use them in a autohotkey script. Is it possible? And how?

Hello MonsterMash,
Please follow the tutorial you'll find in the second post of this thread.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2009, 10:14 pm 
TheGood wrote:
MonsterMash wrote:
Hi,
i don't know if this is the right place to ask for, but i need help.
I want to intercept the press of special keys on my Media center remote controller (as the red, green, yellow and blue keys), and use them in a autohotkey script. Is it possible? And how?

Hello MonsterMash,
Please follow the tutorial you'll find in the second post of this thread.


Hi, thank you! But i need much help. If i'm right, the following function is the most important:

Code:
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) = 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 (iKey <> -1) {
           
            ;Get keycode (located at the 6th byte)
            iKey := NumGet(uData, 5, "UChar")
           
            ;Call the appropriate sub if it exists
            sLabel := sPrefix "_" iKey
            If IsLabel(sLabel)
                Gosub, %sLabel%
        }
    }
}


First of all, i don't understand what are wParam and lParam passed to this function. Can you light me?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2009, 8:06 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Example 2 contains OnMessage(0x00FF, "InputMsg"); this causes InputMsg() to be called whenever the script receives a WM_INPUT message. 0x00FF is the numerical value of WM_INPUT as defined in the Windows SDK. The script must register for Raw Input before it will receive WM_INPUT messages; Example 2 demonstrates how. You should not be calling InputMsg() directly. WM_INPUT Notification at MSDN describes how lParam and wParam may be interpreted and Raw Input contains an overview of the Raw Input/HID API. You probably don't need that much detail if you're using TheGood's script, though.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2009, 11:38 am 
Lexikos wrote:
Example 2 contains OnMessage(0x00FF, "InputMsg"); this causes InputMsg() to be called whenever the script receives a WM_INPUT message. 0x00FF is the numerical value of WM_INPUT as defined in the Windows SDK. The script must register for Raw Input before it will receive WM_INPUT messages; Example 2 demonstrates how. You should not be calling InputMsg() directly. WM_INPUT Notification at MSDN describes how lParam and wParam may be interpreted and Raw Input contains an overview of the Raw Input/HID API. You probably don't need that much detail if you're using TheGood's script, though.


Thank you! Finally i began to understand something :D.

I made some experiment, and wrote this code:

Code:
#Include %A_ScriptDir%\AHKHID.ahk


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)


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) = 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 (iKey <> -1) {
           
            ;Get keycode (located at the 6th byte)
            iKey := NumGet(uData, 5, "UChar")
       inputChecker(iKey)
        }
    }
}

print(iKey, iDescription)
{
IfWinExist Magnifier
WinClose ; close magnifier if it's open
Progress, B2 fs24 zh0 WS700 CW0E4D9A CTFFFFFF, Key Code: %iKey% - Key Name: %iDescription%, , , Courier New ; show last keypress onscreen
SetTimer, RemoveNotice, 3000 ; remove key notice after 3 seconds
}

inputChecker(iKey)
{
if iKey = 36
iDescription := DVD Menu
else if iKey = 12
iDescription := Power
else if iKey = 70
iDescription := TV
else if iKey = 80
iDescription := Radio
else if iKey = 71
iDescription := Music
else if iKey = 73
iDescription := Pictures
else if iKey = 74
iDescription := Videos
else if iKey = 23
iDescription := Record
else if iKey = 21
iDescription := Rewind
else if iKey = 27
iDescription := Replay/Previous Track
else if iKey = 22
iDescription := Play
else if iKey = 24
iDescription := Pause
else if iKey = 25
iDescription := Stop
else if iKey = 20
iDescription := Forward
else if iKey = 26
iDescription := Skip/Next Track
else if iKey = 35
iDescription := Back
else if iKey = 15
iDescription := More/Information
else if iKey = 30
iDescription := Up Arrow
else if iKey = 32
iDescription := Left Arrow
else if iKey = 33
iDescription := Right Arrow
else if iKey = 31
iDescription := Down Arrow
else if iKey = 34
iDescription := OK
else if iKey = 16
iDescription := Volume Up
else if iKey = 17
iDescription := Volume Down
else if iKey = 13
iDescription := Windows Media Center
else if iKey = 14
iDescription := Mute
else if iKey = 18
iDescriptioin := Channel/Page Up
else if iKey = 19
iDescription := Channel/Page Down
else if iKey = 71
iDescription := Live TV
else if iKey = 38
iDescription := Guide
else if iKey = 72
iDescription := Recorded TV
else if iKey = 1
iDescription := 1
else if iKey = 2
iDescription := 2/ABC
else if iKey = 3
iDescription := 3/DEF
else if iKey = 4
iDescription := 4/GHI
else if iKey = 5
iDescription := 5/JKL
else if iKey = 6
iDescription := 6/MNO
else if iKey = 7
iDescription := 7/PQRS
else if iKey = 8
iDescription := 8/TUV
else if iKey = 9
iDescription := 9/WXYZ
else if iKey = 29
iDescription := *
else if iKey = 0
iDescription := 0
else if iKey = 28
iDescription := #
else if iKey = 10
iDescription := Clear
else if iKey = 78
iDescription := Print
else if iKey = 11
iDescription := Enter
print(iKey, iDescription)
Return
}

RemoveNotice:
SetTimer, RemoveNotice, Off
Progress, Off
return


In my mind this must notify on screen every time i press a key on my remote controller, and write the key code and a key description. But it does not work.
What did i wrong?

Thank you again.
Bye.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2009, 12:16 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
The most obvious problem is the recurring syntax error:
Code:
iDescription := DVD Menu   ; bad
iDescription := "DVD Menu" ; good
iDescription = DVD Menu    ; good


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 17th, 2009, 5:53 pm 
Offline

Joined: February 5th, 2009, 9:12 am
Posts: 59
bxr wrote:
In another words, how do you disable the original key presses of the MCE remote such as 0-9 numbers and replace them?


You can find detailed info (which I'd tried to explain before in page 5) here http://mediacenterguides.com/sites/default/files/IRCodes_ReportMappingTable_InputINF.pdf (the pdf is not mine)

this reg file will disable 0-9 for you...


Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HidIr\Remotes\745a17a0-74d3-11d0-b6fe-00a0c90f57da]
"ReportMappingTable"=hex:01,00,00,00,00,00,00,02,00,00,00,00,00,00,03,00,00,00,\
    00,00,00,04,00,00,00,00,00,00,05,00,00,00,00,00,00,06,00,00,00,00,00,00,07,\
    00,00,00,00,00,00,08,00,00,00,00,00,00,09,00,00,00,00,00,00,00,00,00,00,00,\
    00,00,
0b,00,00,00,04,08,58,0a,00,00,00,04,00,29,1f,00,00,00,04,00,51,1e,00,\
    00,00,04,00,52,21,00,00,00,04,00,4f,20,00,00,00,04,00,50,22,00,00,00,04,00,\
    28,4e,00,00,00,04,08,45,0f,00,00,00,01,09,02,23,00,00,00,01,24,02,16,00,00,\
    00,01,b0,00,18,00,00,00,01,b1,00,17,00,00,00,04,08,52,14,00,00,00,01,b3,00,\
    15,00,00,00,01,b4,00,1a,00,00,00,01,b5,00,1b,00,00,00,01,b6,00,19,00,00,00,\
    01,b7,00,6e,00,00,00,01,cd,00,10,00,00,00,01,e9,00,11,00,00,00,01,ea,00,0e,\
    00,00,00,01,e2,00,26,00,00,00,01,8d,00,12,00,00,00,01,9c,00,13,00,00,00,01,\
    9d,00,0c,00,00,00,04,09,2b,2a,00,00,00,03,82,00,34,00,00,00,04,08,51,1c,00,\
    00,00,04,08,58,
"CodeSetNum0"=dword:00000001
"CodeSetNum1"=dword:00000002
"CodeSetNum2"=dword:00000003
"CodeSetNum3"=dword:00000004


NOTES:
Code:
In this reg file:
Power            = Ctrl + Win + Tab
Vizualization    = Ctrl + Esc
#                = Win + Intro
Rec              = Win + Up
Eject            = Win + Down



TheGood wrote:
Can't you use SendInput? Or is the MCE interface not always in the foreground?


Every send mode works while MCE is in the foreground, but ControlSend won't work in foreground neither background.

I'm gonna try again and check window spy


Last edited by bidomo on June 17th, 2009, 11:25 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2009, 6:37 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
Thanks bidomo.
I haven't looked at the PDF file in-depth yet, but when I do, I will modify the first post to show how to use this method to disable keypresses.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2009, 7:30 pm 
Lexikos wrote:
The most obvious problem is the recurring syntax error:
Code:
iDescription := DVD Menu   ; bad
iDescription := "DVD Menu" ; good
iDescription = DVD Menu    ; good


Thank you, i'm not so expert in this language.

But also with these modifications the script does not work. There must be something else...

Thank you.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2009, 7:40 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
MonsterMash,
Do you have exactly the same remote as me? (I see you're using the same ProductID, VendorID, etc... as me).
Also, you should debug it, using MsgBoxes or OutputDebug (more recommended), to see where exactly you lose contact.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2009, 9:43 pm 
TheGood wrote:
MonsterMash,
Do you have exactly the same remote as me? (I see you're using the same ProductID, VendorID, etc... as me).
Also, you should debug it, using MsgBoxes or OutputDebug (more recommended), to see where exactly you lose contact.


My remote isn't the same of the your, but using your example2 i saw that all parameters are the same (ProductId, VendorId, VersionNumber, Usage Page and Usage).

I don't know most of IO functions, now i will look for some documentation about MshBox and OutputDebug.

Thank you, bye.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2009, 1:50 am 
I found my error: forgot
Code:
Gui, +LastFound

at the beginning of the script.

Now it works perfectly. :)


Thank you all.


Bye


Report this post
Top
  
Reply with quote  
 Post subject: Example 2 problem
PostPosted: June 21st, 2009, 12:19 am 
Offline

Joined: June 6th, 2009, 2:07 pm
Posts: 9
Location: Here
I followed the instructions through Example 1 and got the device's

Vendor ID = 2683
Product ID = 53248
Version Number = 1
Usage Page = 1
Usage = 4

Then I input the usage page and usage value into example 2 and added then called so I could start getting the raw data and data started flooding into the listbox. It never stopped. So I'm at a loss for what to do next since its almost impossible for me to extract any data from it.

This is the HID I want to bend to my will.
http://upload.wikimedia.org/wikipedia/c ... ollers.jpg

Certain buttons do accept commands from autohotkey but there are other areas of the Joystick that dont like the tuner dial + toggle switches + Communication buttons

This is where I got the drivers which were made specifically for connecting the Joystick to the computer.
http://vt.beckament.net/

I used a USB adapter that allows me to plug Xbox controls to the PC for the connection.


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 ... 3, 4, 5, 6, 7, 8, 9 ... 27  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, Google [Bot], Jaaaaaaaaay, Ragnar, Retro Gamer and 10 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