Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Google TV Revue Keyboard K700 Script! Full Funtional Keypres


  • Please log in to reply
23 replies to this topic
werdna219
  • Members
  • 2 posts
  • Last active: Jan 03 2012 11:26 PM
  • Joined: 07 Dec 2011
Got an HTPC and want the Best Keyboard on the market?

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!

aaffe
  • Members
  • 1045 posts
  • Last active: Jan 16 2014 01:32 PM
  • Joined: 17 May 2007
You dont need the
gosub donothing
because the return after it does the same....

davieboynj
  • Members
  • 4 posts
  • Last active: Jul 08 2012 07:40 PM
  • Joined: 08 Jul 2012
Had to register just to tell you that you rule!

my K700 is now much more useful.

When I get some time, I'm going to look into adding to your script ("tv" goes to "live tv", guide goes to guide, "dvr" goes into recorded tv, "Home" button emulates "the green button", "FN + 1-0,-,+" emulates F1-12)

As this is my first dabble into AHK, if anyone can point me in the right direction, I'd appreciate it.

Thanks Again!

davieboynj
  • Members
  • 4 posts
  • Last active: Jul 08 2012 07:40 PM
  • Joined: 08 Jul 2012

;msgbox %vals%
ifequal, Vals, 03B0000000, gosub play
ifequal, Vals, 03B4000000, gosub back


Added these:


ifequal, Vals, 0323020000, gosub home
ifequal, Vals, 032a020000, gosub favorite
ifequal, Vals, 03F1010000, gosub maximize

werdna219
  • Members
  • 2 posts
  • Last active: Jan 03 2012 11:26 PM
  • Joined: 07 Dec 2011
I might make your day even better. I coded all buttons in yellow but left the destinations blank. So all you gotta do is tell the code what you want the button to do. Enjoy! And thank you!

davieboynj
  • Members
  • 4 posts
  • Last active: Jul 08 2012 07:40 PM
  • Joined: 08 Jul 2012
sweet! I'm on my way...

davieboynj
  • Members
  • 4 posts
  • Last active: Jul 08 2012 07:40 PM
  • Joined: 08 Jul 2012
If you're a Windows media center fan who wants to use a k700, this might be the script for you:

Favorite (Star) -> Green Button
Search Button -> LAlt
Internet Home -> info
Fn + 1 thru = -> F1 thru F12
TV/Guide/DVR -> Live TV/Guide/Recorded TV
AVR -> Random Music Play
STB -> Standby
TV -> Force Close Media Center

(adapted from the above 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, 038D000000, gosub guide
  ifequal, Vals, 039a000000, gosub dvr
  ifequal, Vals, 039C000000, gosub channel_up
  ifequal, Vals, 039D000000, gosub channel_down

  ifequal, Vals, 0323020000, gosub home
  ifequal, Vals, 032A020000, gosub favorite
  ifequal, Vals, 03F1010000, gosub maximize

  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, 03F0012300, gosub function_home
  ifequal, Vals, 03F001B200, gosub function_favorite
  ifequal, Vals, 03F001f100, gosub function_maximize


  ifequal, Vals, 03F0011e00, gosub function_1
  ifequal, Vals, 03F0011f00, gosub function_2
  ifequal, Vals, 03F0012000, gosub function_3
  ifequal, Vals, 03F0012100, gosub function_4
  ifequal, Vals, 03F001F500, gosub function_5
  ifequal, Vals, 03F001F400, gosub function_6
  ifequal, Vals, 03F001F700, gosub function_7
  ifequal, Vals, 03F001F600, gosub function_8
  ifequal, Vals, 03F001EF00, gosub function_9
  ifequal, Vals, 03F001FF00, gosub function_0
  ifequal, Vals, 03F0012E00, gosub function_-
  ifequal, Vals, 03F0012D00, gosub function_=


  ;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}
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
;/////////////////////////////////////////////////// 

;/////////////////////////////////////////////////// 
stop:
   IfWinActive, ahk_class eHome Render Window
   {
        gosub donothing
        return
   }

   ;else
   send {media_stop}
return
;/////////////////////////////////////////////////// 

;/////////////////////////////////////////////////// 
pause:
   IfWinActive, ahk_class eHome Render Window
   {
        gosub donothing
        return
   }

   ;else
   send {media_pause}
return
;/////////////////////////////////////////////////// 



AVR:
run %windir%\ehome\ehshell.exe /playslideshowwithmusic /nostartupanimation /directmedia:general
return

STB:
DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
return

TV:
run, taskkill /im ehshell.exe,,hide
return



Volume_Down:
Send {volume_down}
return

Volume_up:
send {volume_up}
return

googleTV:
run %windir%\ehome\ehshell.exe “/mcesuperbar://tv?live=true” /nostartupanimation /directmedia:general
return

guide:
return

DVR:
run %windir%\ehome\ehshell.exe /directmedia:tv /nostartupanimation /directmedia:general
return

channel_Up:

return

channel_Down:

return

function:
return



home:
return

favorite:
run %windir%\ehome\ehshell.exe /nostartupanimation /directmedia:general
return
 
maximize:
  WinGet MX, MinMax, A
   If MX
        WinRestore A
   Else WinMaximize A
return



function_prev:
send {media_prev}
return

function_next:
send {media_next}
return

function_play:
send {media_play}
return

function_pause:
send {media_stop}
return

function_home:
send ^r
return

function_favorite:
run, taskkill /im ehshell.exe,,hide
return

function_maximize:
  WinGet MX, MinMax, A
   If MX
        WinRestore A
   Else WinMaximize A
return



function_1:
send {F1}
return

function_2:
send {F2}
return

function_3:
send {F3}
return

function_4:
send {F4}
return

function_5:
send {F5}
return

function_6:
send {F6}
return

function_7:
send {F7}
return

function_8:
send {F8}
return

function_9:
send {F9}
return

function_0:
send {F10}
return

function_-:
send {F11}
return

function_=:
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 < 2
    Number = 0%Number%
    return Number
}   

volume_mute::RButton
LWin::Alt
*Tab::AltTab
Browser_Home::AppsKey
;Media_fastfwd::AppsKey
;Media_rewind::AppsKey


mtuck
  • Members
  • 4 posts
  • Last active: Jul 13 2012 08:31 PM
  • Joined: 13 Jul 2012
Very excited to see this thread. I just built a HTPC and I have a k700 keyboard that I would love to be able to get more functionality out of.

I am a total noob to AHK and I need some help. Can someone give me some pointers on getting this script up and running on my new system?

Do I just need to copy the script from the post above and run it?

Any help would be greatly appreciated.

mtuck
  • Members
  • 4 posts
  • Last active: Jul 13 2012 08:31 PM
  • Joined: 13 Jul 2012
Got it figured out. I didn't have vcredist_x86.exe installed. Once I did that, all was fine.

Thanks for the script.

AZNguyen
  • Members
  • 1 posts
  • Last active: Jul 26 2012 11:30 PM
  • Joined: 26 Jul 2012
Someone mind helping me set this up? The Micha Dll links are all dead.

mtuck
  • Members
  • 4 posts
  • Last active: Jul 13 2012 08:31 PM
  • Joined: 13 Jul 2012
Here are the files you need in order to make this work: <!-- m -->http://www.mediafire...6b1mq9dtkapkb7s<!-- m -->

Hope that helps.

~mtuck

  • Guests
  • Last active:
  • Joined: --
I am trying to get this script working and i cant seem to... can someone post directions to getting this?

mtuck
  • Members
  • 4 posts
  • Last active: Jul 13 2012 08:31 PM
  • Joined: 13 Jul 2012

I am trying to get this script working and i cant seem to... can someone post directions to getting this?


First download and install Auto Hot Key from here: http://www.autohotkey.com/download/

Then follow these steps:

1. Copy the script that is posted in the forum for the k700.
2. Paste the script into a blank NotePad doc.
3. Save the file as an .ahk file. I used "Logitech_K700.ahk"
4. Click on the new .ahk file and Click "run script" in the toolbar.

I had to run the vcredist_86x.exe in order for the script to work.

Hope that helps.

~mtuck

  • Guests
  • Last active:
  • Joined: --
Thanks for the help.. Got it working for the most part. The green button isnt working nor is the TV button and or the DVR button.. And how would i be able to make the home button act as the media center green button and the star button act as the info button?

  • Guests
  • Last active:
  • Joined: --
I did more checking.. The yellow record function doesnt work with this script running as well...