Thought I'd share my settings. My system now does the following:
If XBMC is the active window:
- "MY VIDEOS" button opens Movies
- "MY TV" button opens TV Shows
- "MY MUSIC" button opens Music
- "MY PICTURES" opens Pictures
- "POWER" opens XBMC Shutdown menu
- "GREEN BUTTON" goes to Home
If XBMC is open, but not the active window, the above buttons activate the XBMC window and then do the same as I mentioned before.
If XBMC not open, the buttons launch XBMC, wait
up to 10 seconds for it to load, then they do the same as above again, EXCEPT FOR:
- "POWER" -- HIBERNATES the PC (shutdown /h)
To do the same as this, all you need is AutoIt 3, then make the following changes...
Open XBMC/system/Keymap.xml. Find the first section named <keyboard> (within <global>...</global>). In there, just add these to the end (right before </keyboard>):
Code:
<home>XBMC.ActivateWindow(Home)</home>
<v>XBMC.ActivateWindow(videolibrary,movietitles)</v>
<m>XBMC.ActivateWindow(MyMusic)</m>
<n>XBMC.ActivateWindow(MyPictures)</n>
<b>XBMC.ActivateWindow(videolibrary,tvshowtitles)</b>
Now, the keyboard buttons home, v, m, n, b all perform the above actions.
Create the following files in your XBMC directory: PressV.au3, PressM.au3, PressN.au3, PressB.au3. Set them all to have this content, but change the info in bold:
Code:
If ProcessExists("xbmc.exe") Then
If WinActive("[TITLE:XBMC]") Then
[b]Send("B")[/b]
Else
WinActivate("[TITLE:XBMC]")
If WinWaitActive("[TITLE:XBMC]", "", 10) Then
Sleep(2000)
[b]Send("B")[/b]
EndIf
EndIf
Else
ShellExecute("[b]G:\Program Files\XBMC\XBMC.exe[/b]", "-fs -p", "[b]G:\Program Files\XBMC[/b]", "open")
If WinWaitActive("[TITLE:XBMC]", "", 10) Then
Sleep(2000)
[b]Send("B")[/b]
EndIf
EndIf
Send("B") should be the button you are pressing (V, B, M, N). The two bolded paths should point to your XBMC install (note that mine is G:\, the average user installs to C:\).
Next, create "Green Button.au3", set its content to:
Code:
If ProcessExists("xbmc.exe") Then
If WinActive("[TITLE:XBMC]") Then
Send("{HOME}")
Else
WinActivate("[TITLE:XBMC]")
EndIf
Else
ShellExecute("[b]G:\Program Files\XBMC\XBMC.exe[/b]", "-fs -p", "[b]G:\Program Files\XBMC[/b]", "open")
EndIf
Again, change the path.
Finally, create Shutdown.au3:
Code:
If ProcessExists("xbmc.exe") Then
If WinActive("[TITLE:XBMC]") Then
Send("S")
Else
WinActivate("[TITLE:XBMC]")
If WinWaitActive("[TITLE:XBMC]", "", 10) Then
Sleep(2000)
Send("S")
EndIf
EndIf
Else
[b]ShellExecute("C:\Windows\System32\shutdown.exe", "/h", "C:\Windows\System32", "open")[/b]
EndIf
Note the bolded line. That calls shutdown.exe in Windows/System32/ with the argument /h, meaning hibernate. Change it as you wish (-s is shutdown, no arguments is sleep, I believe). Heck, remove that line and the Else above it, and it will remove the shutdown all together and will only function while in XBMC.
Select and right click all of these files, pick Compile Script. They should all have .exe counterparts in the dir now.
Now, the IR Server stuff. Open Translator, apply run commands to button mappings to the new .exe files (as described on page 5). Voila, that's all. Thanks to GergDees for the original AutoIt idea for this!