Autohotkey for The Green Button?
- makryger
- Posts: 2132
- Joined: Sun Jun 05, 2011 2:01 pm
- Location: Illinois
- HTPC Specs:
Autohotkey for The Green Button?
I just starting to use autohotkey to make some tasks (like turning the tv and audio on and off) a bit smarter, and one of the things I'd like to do is assign the green button to a slightly different function. Is this possible? I tried using the key logger included in AHK, but it didn't log anything when I pressed the green button.
My Channel Logos XL: Get your Guide looking good! ~~~~ TunerSalad: Increase the 4-tuner limit in 7MC
- makryger
- Posts: 2132
- Joined: Sun Jun 05, 2011 2:01 pm
- Location: Illinois
- HTPC Specs:
It does, but I need to go in the other direction- I want to assign the physical button to a different key combination, rather than assign the button function to something new.
My Channel Logos XL: Get your Guide looking good! ~~~~ TunerSalad: Increase the 4-tuner limit in 7MC
- STC
- Posts: 6808
- Joined: Mon Jun 06, 2011 4:58 pm
- Location:
- HTPC Specs:
Okay, now i've got my head around that, I don't think that would be a AHK function direct. You'd need something a layer above AHK to jig the IR db code(?)
By the Community, for the Community. 100% Commercial Free.
Want decent guide data back? Check out EPG123
Want decent guide data back? Check out EPG123
-
- Posts: 465
- Joined: Fri Jan 13, 2012 5:16 am
- Location:
- HTPC Specs:
I use the ReportMappingTable registry hack to map Windows+Alt+Enter (global Windows shortcut for starting Media Center) to the physical green button, which otherwise generates an HID event instead of a normal keypress. Then in my autohotkey script, I have:
You can map any key combination to the green button you want; it doesn't have to be Win+Alt+Enter.
Aside: Among many other things, I map the "DVD Audio" remote button to Win+Shift+Alt+Enter in ReportMappingTable to launch XBMC. As I don't actually have a remote with that button, I program a JP1 remote with it and a handful of other missing buttons, and then I use that remote to teach it to a button on my Sony RM-VL610. My autohotkey script contains:
There are several fairly useless remote buttons Windows defines that I usurp in this way. It all works seamlessly, and I can include these learned buttons in remote macros that turn equipment off and on, select the proper inputs, etc.
Code: Select all
; Start Media Center
#!Enter::
IfWinExist, ahk_class iTunes
{
WinActivate
Send !{F4} ; Exit program
}
IfWinExist, ahk_class XBMC
{
WinActivate
Send !{F4} ; Exit program
}
Send #!{Enter}
return
Aside: Among many other things, I map the "DVD Audio" remote button to Win+Shift+Alt+Enter in ReportMappingTable to launch XBMC. As I don't actually have a remote with that button, I program a JP1 remote with it and a handful of other missing buttons, and then I use that remote to teach it to a button on my Sony RM-VL610. My autohotkey script contains:
Code: Select all
; Start XBMC
; Win+Alt+Enter is the shortcut for GreenButton; I use Win+Alt+Shift+Enter for XBMC
#!+Enter::
IfWinExist, ahk_class iTunes
{
WinActivate
Send !{F4} ; Exit program
}
IfWinExist, ahk_class eHome Render Window
{
WinActivate
Send !{F4} ; Exit program
}
IfWinNotExist, ahk_class XBMC ;If XBMC is shutdown
{
Run "C:\Program Files (x86)\XBMC\XBMC.exe"
WinWait,XBMC,,5
If ErrorLevel
{
MsgBox, XBMC Startup timed out.
return
}
}
else
{
WinActivate
WinMaximize
WinShow
}
return
Last edited by crawfish on Thu Nov 01, 2012 2:38 am, edited 1 time in total.
-
- Posts: 465
- Joined: Fri Jan 13, 2012 5:16 am
- Location:
- HTPC Specs:
Posting to the forum lost all the indenting in my AHK script. Oh well. (ETA: Edited to format as "code" on 10/31.)
Also, exiting iTunes is nice because iTunes can interfere with the operation of the remote, grabbing some buttons for itself despite not having the focus. It's possible to disable iTunes processing of multimedia keys by fiddling with iTunes' AppCommandMessageProcessingEnabled property using VBS, but it just isn't reliable. Exiting iTunes is the way to go. And obviously you don't want MC running while XBMC is running or vice versa.
Also, exiting iTunes is nice because iTunes can interfere with the operation of the remote, grabbing some buttons for itself despite not having the focus. It's possible to disable iTunes processing of multimedia keys by fiddling with iTunes' AppCommandMessageProcessingEnabled property using VBS, but it just isn't reliable. Exiting iTunes is the way to go. And obviously you don't want MC running while XBMC is running or vice versa.
Last edited by crawfish on Thu Nov 01, 2012 2:39 am, edited 1 time in total.
- STC
- Posts: 6808
- Joined: Mon Jun 06, 2011 4:58 pm
- Location:
- HTPC Specs:
That looks promising...
I use the star key on the remote to perform a specific function through AHK without it interfering with other functions.
I use the star key on the remote to perform a specific function through AHK without it interfering with other functions.
By the Community, for the Community. 100% Commercial Free.
Want decent guide data back? Check out EPG123
Want decent guide data back? Check out EPG123
-
- Posts: 465
- Joined: Fri Jan 13, 2012 5:16 am
- Location:
- HTPC Specs:
Yeah, * (Shift+8), # (Shift+3), and Clear (Esc) are the easy ones. You can override those in AHK without messing with ReportMappingTable in the registry, and I've never missed their intended functions. They do need to be inside a block like this of course:
#IfWinActive ahk_class eHome Render Window
...
#IfWinActive
#IfWinActive ahk_class eHome Render Window
...
#IfWinActive
- makryger
- Posts: 2132
- Joined: Sun Jun 05, 2011 2:01 pm
- Location: Illinois
- HTPC Specs:
Thanks crawfish- your response would be the right one, if not for the fact that I use a gyration remote, which doesn't seem to jive with this hack, from my additional reading.
I may just have to use a *... not quite as seemless as I would have hoped, but better than nothing.
I may just have to use a *... not quite as seemless as I would have hoped, but better than nothing.
My Channel Logos XL: Get your Guide looking good! ~~~~ TunerSalad: Increase the 4-tuner limit in 7MC
-
- Posts: 465
- Joined: Fri Jan 13, 2012 5:16 am
- Location:
- HTPC Specs:
Have you checked out AHKHID?
http://www.autohotkey.com/forum/topic41397.html
It might help you with the Gyration.
http://www.autohotkey.com/forum/topic41397.html
It might help you with the Gyration.