K700 Logitech Keyboard!!!
One problem? All of the buttons dont work on windows. Well thanks to Micha and AHK they do now!
Every yellow key on the keyboard will work as designed (hopefully) with this code!
Let me know if you have any questions!
Tutorial
Using Micha Dll from the 64 bit windows 7 post here
<!-- m -->http://www.autohotke... ... ll&start=0<!-- m -->
make sure u change all goto to gosub
the code in remotecontrol will show you how to find the binary code for each key
;msgbox %vals%
ifequal, Vals, 03B0000000, gosub play
ifequal, Vals, 03B4000000, gosub back
ifequal, Vals, 03B3000000, gosub forward
ifequal, Vals, 03B1000000, gosub pause
ifequal, Vals, 03F3010000, gosub AVR
ifequal, Vals, 03FC010000, gosub STB
ifequal, Vals, 03FE010000, gosub TV
ifequal, Vals, 03EA000000, gosub Volume_Down
ifequal, Vals, 03E9000000, gosub volume_up
ifequal, Vals, 0389000000, gosub googleTV
ifequal, Vals, 039C000000, gosub channel_up
ifequal, Vals, 039D000000, gosub channel_down
ifequal, Vals, 03F0010000, gosub function
the msgbox that is currently commented out is the window that will display what you hit on any HID device
Install Micha Dll to the same folder then load in this script:
; AutoHotkey Version: 1.x
; Language: English
; Platform: Windows 7
; Author: Werdna219
;
; Script Function:
; Template AutoHotkey script.
;
;Path to AutohotkeyRemoteControl.dll
HomePath=AutohotkeyRemoteControl.dll
;HomePath=release\AutohotkeyRemoteControl.dll
;Load the dll
hModule := DllCall("LoadLibrary", "str", HomePath) ; Avoids the need for DllCall() in
OnMessage(0x00FF, "InputMsg")
DetectHiddenWindows, on
;SetTimer,UPDATEDSCRIPT,1000
;Register my device
EditUsage = 136
EditUsagePage = 65468
Gui, Show, x0 y0 h0 w0, Autohotkey HID-Support
;HWND := WinActive("F:\myprg\Win\Autohotkeyremote\AutohotkeyRemoteControl\RemoteControl.ahk")
HWND := WinExist("Autohotkey HID-Support")
nRC := DllCall("AutohotkeyRemoteControl\RegisterDevice", INT, EditUsage, INT, EditUsagePage, INT, HWND, "Cdecl UInt")
if (errorlevel <> 0) || (nRC == -1)
{
MsgBox RegisterDevice fehlgeschlagen. Errorcode: %errorlevel%
Gosub cleanup
}
;Register another device
EditUsage = 1
EditUsagePage = 12
nRC := DllCall("AutohotkeyRemoteControl\RegisterDevice", INT, EditUsage, INT, EditUsagePage, INT, HWND, "Cdecl UInt")
Winhide, Autohotkey HID-Support
return
InputMsg(wParam, lParam, msg, hwnd)
{
DataSize = 5000
VarSetCapacity(RawData, %DataSize%)
;MsgBox eingetroffen %wParam% %lParam% %msg% %HWND%
;Write something into the var, so the script won't be aborted :
;(g_script.ScriptError("This DllCall requires a prior VarSetCapacity. The program is now unstable and will exit.");)
RawData = 1
nRC := DllCall("AutohotkeyRemoteControl\GetWM_INPUTHIDData", UINT, wParam, UINT, lParam, "UINT *" , DataSize, "UINT", &RawData, "Cdecl UInt")
if (errorlevel <> 0) || (nRC == -1)
{
MsgBox GetWM_INPUTHIDData fehlgeschlagen. Errorcode: %errorlevel%
Gosub cleanup
}
loop, %DataSize%
{
;Zahl := ExtractInteger(RawData, a_index-1,false,1)
Zahl := NumGet(RawData, a_index-1,"UChar")
Zahl := Dez2Hex(Zahl)
Vals = %Vals%%Zahl%
}
;msgbox %vals%
ifequal, Vals, 03B0000000, gosub play
ifequal, Vals, 03B4000000, gosub prev
ifequal, Vals, 03B3000000, gosub next
ifequal, Vals, 03B1000000, gosub pause
ifequal, Vals, 03F3010000, gosub AVR
ifequal, Vals, 03FC010000, gosub STB
ifequal, Vals, 03FE010000, gosub TV
ifequal, Vals, 03EA000000, gosub Volume_Down
ifequal, Vals, 03E9000000, gosub volume_up
ifequal, Vals, 0389000000, gosub googleTV
ifequal, Vals, 039C000000, gosub channel_up
ifequal, Vals, 039D000000, gosub channel_down
ifequal, Vals, 03F0010000, gosub function
ifequal, Vals, 03F001B600, gosub function_prev
ifequal, Vals, 03F001B500, gosub function_next
ifequal, Vals, 03F001B000, gosub function_play
ifequal, Vals, 03F001B700, gosub function_pause
;ifequal, Vals, 0300000000, gosub pressup
;Mute is at the bottom of this code
}
return
donothing:
return
;///////////////////////////////////////////////////
play:
IfWinActive, ahk_class eHome Render Window
{
gosub donothing
return
}
;else
send {media_play_pause}
return
;////////////////////////////////////////////////////
;///////////////////////////////////////////////////
prev:
IfWinActive, ahk_class eHome Render Window
{
gosub donothing
return
}
;else
send {media_prev}
return
;///////////////////////////////////////////////////
;///////////////////////////////////////////////////
next:
IfWinActive, ahk_class eHome Render Window
{
gosub donothing
return
}
;else
send {media_Next}
return
;///////////////////////////////////////////////////
;///////////////////////////////////////////////////
pause:
IfWinActive, ahk_class eHome Render Window
{
gosub donothing
return
}
;else
send {media_play_pause}
return
;///////////////////////////////////////////////////
AVR:
Msgbox LiveTV
return
;Send Computer into standby
STB:
DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
return
TV:
Msgbox Radio
return
Volume_Down:
Send {volume_down}
return
Volume_up:
send {volume_up}
return
googleTV:
Msgbox LastCH
return
channel_Up:
return
channel_Down:
return
function:
return
function_prev:
send {media_prev}
return
function_next:
send {media_next}
return
function_play:
send {media_play_pause}
return
function_pause:
send {medai_play_pause}
return
cleanup:
DllCall("FreeLibrary", "UInt", hModule) ; It is best to unload the DLL after using it (or before the script exits).
ExitApp
UPDATEDSCRIPT:
FileGetAttrib,attribs,%A_ScriptFullPath%
IfInString,attribs,A
{
FileSetAttrib,-A,%A_ScriptFullPath%
SplashTextOn,,,Updated script,
Sleep,500
Reload
}
Return
SendDVDKey(Key)
{
IfWinNotExist , InterVideo WinDVD 7
{
return
}
Winactivate, InterVideo WinDVD 7
Send, %Key%
}
Dez2Hex(Number)
{
format = %A_FormatInteger% ; save original integer format
SetFormat Integer, Hex ; for converting bytes to hex
Number += 0
SetFormat Integer, %format% ; restore original format
StringTrimLeft, Number, Number, 2
Stringlen := StrLen(Number)
if Stringlen < 2
Number = 0%Number%
return Number
}
If you hate the right click trick convert the volume_mute button into a right click!
Add this to the end of the code:
volume_mute::RButton
Enjoy!




