; AutoHotkey Version: 1.x ; Language: English ; Platform: Windows 7 ; Author: Werdna219 ; ; Script Function: ; Template AutoHotkey script. ; ;Path to AutohotkeyRemoteControl.dll HomePath=AutohotkeyRemoteControl.dll ;HomePath=releaseAutohotkeyRemoteControl.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:myprgWinAutohotkeyremoteAutohotkeyRemoteControlRemoteControl.ahk") HWND := WinExist("Autohotkey HID-Support") nRC := DllCall("AutohotkeyRemoteControlRegisterDevice", 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("AutohotkeyRemoteControlRegisterDevice", INT, EditUsage, INT, EditUsagePage, INT, HWND, "Cdecl UInt") Winhide, Autohotkey HID-Support start := 0 step := 15 loop { if (fn_down=1) { if (start=0) { MouseGetPos, xx, yy start := 1 } else { MouseGetPos, _x, _y loop { curr := (_y - yy) // step if (curr 0) { ;SystemCursor(0) send {wheeldown} sleep 5 _y := _y - step ;pos++ } if (curr = 0) break } loop { curr := (_x - xx) // step if (curr 0) { ;SystemCursor(0) send {wheelright} sleep 5 _x := _x - step ;pos++ } if (curr = 0) break } MouseMove, _x, _y, 0 } } else if (start = 1) { start := 0 SystemCursor(1) MouseMove, xx, yy, 0 } sleep 25 } 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("AutohotkeyRemoteControlGetWM_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% ;return ifequal, Vals, 03B0000000, gosub play ifequal, Vals, 03B4000000, gosub prev ifequal, Vals, 03B3000000, gosub next ifequal, Vals, 03B1000000, gosub pause ifequal, Vals, 03F1010000, gosub unkonwn ifequal, Vals, 032A020000, gosub star ;默认就可以用 ;ifequal, Vals, 0324020000, gosub arrow ifequal, Vals, 0323020000, gosub home 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, 038d000000, gosub guide ifequal, Vals, 039a000000, gosub dvr 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, 03F101F100, gosub function_unkonwn ifequal, Vals, 03F0011e00, gosub function_f1 ifequal, Vals, 03F0011f00, gosub function_f2 ifequal, Vals, 03F0012000, gosub function_f3 ifequal, Vals, 03F0012100, gosub function_f4 ifequal, Vals, 03F001f500, gosub function_f5 ifequal, Vals, 03F001f400, gosub function_f6 ifequal, Vals, 03F001f700, gosub function_f7 ifequal, Vals, 03F001f600, gosub function_f8 ifequal, Vals, 03F001ef00, gosub function_f9 ifequal, Vals, 03F001ff00, gosub function_f10 ifequal, Vals, 03F0012e00, gosub function_f11 ifequal, Vals, 03F0012d00, gosub function_f12 ifequal, Vals, 0300000000, gosub function_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 ;/////////////////////////////////////////////////// unkonwn: Run calc.EXE return star: return AVR: Msgbox AVR return ;Send Computer into standby STB: DllCall("PowrProfSetSuspendState", "int", 0, "int", 0, "int", 0) return TV: Msgbox TV return Volume_Down: Send {volume_down} return Volume_up: send {volume_up} return googleTV: Msgbox googleTV return guide: return dvr: Send,^c return channel_Up: return channel_Down: return function: fn_down := 1 return function_pressup: fn_down := 0 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 function_unkonwn: return function_f1: send {f1} return function_f2: send {f2} return function_f3: send {f3} return function_f4: send {f4} return function_f5: send {f5} return function_f6: send {f6} return function_f7: send {f7} return function_f8: send {f8} return function_f9: send {f9} return function_f10: send {f10} return function_f11: send {f11} return function_f12: send {f12} 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