HTPC Geek Project: Launching Netflix WMC and Hulu Desktop from XBMC

One of my nerdiest hobbies is tweaking the software on my HTPC, a custom Windows 7 box I built with a very good friend of mine after its predecessor fell short of my expectations.

My current remote-friendly front-end of choice is XBMC (version 11, “Eden”). I thought I’d share how I got it to launch the Netflix portion of Windows Media Center and Hulu Desktop from the home screen using AutoHotkey and a couple of add-ons.

Prerequisites

Before we begin, make sure everything here is installed and ready to go:

We’ll also need these XBMC add-ons, both available in the XBMC.org Add-ons repo in the Program Add-ons group. Refer to this how-to if you need help.

Getting the remote to play nice

Most Media Center remotes send these low-level commands that are interpreted by something called an “eHome” driver. This makes the customization of these commands pretty frustrating, and the software that’s available to help you through it is either over-reaching or completely unintuitive. Thankfully, the MCERemote add-on helps us deal with that pesky issue by remapping those commands to more agreeable keystrokes.

Navigate to the MCERemote add-on and follow the instructions therein to apply (and optionally customize) the changes. If you change your mind later, you can reverse these changes from this same add-on.

Launching XBMC from the start button

Sometimes referred to as the “Media Center,” “MCE” or “green” button, the start button is prominent on just about every HTPC remote and in the configuration options for the Harmony One. Normally this will launch Windows Media Center, but we want it to launch XBMC. Thankfully, the MCERemote add-on remaps this command to Control + Shift + Win, which we can listen for using an AutoHotkey script.

Create a new file called launch-xbmc.ahk (or something similar) with these contents:

^+W::
IfWinExist, Windows Media Center
{
    WinClose, Windows Media Center
}
IfWinExist, Hulu Desktop
{
    WinClose, Hulu Desktop
}
IfWinNotExist, XBMC
{
    Run, "C:\Program Files (x86)\XBMC\XBMC.exe" "C:\Program Files (x86)\XBMC"
}
WinRestore, XBMC
WinActivate, XBMC
return

After you’ve saved the file, double-click it. You should see a little AutoHotkey icon in your taskbar indicating that a script is running. While running, the start button will tell your PC to do this:

  1. Close Windows Media Center if it’s open.
  2. Close Hulu Desktop if it’s open.
  3. Open XBMC if it isn’t open.
  4. Bring the XBMC window to the foreground.

To ensure this script is always running, I recommend placing a shortcut to it in your programs’ “startup” directory.

Launching Netflix and Hulu Desktop

Next, we need to create two more scripts that we can launch from within XBMC. Both scripts do essentially the same thing:

  1. Run the app.
  2. Make sure the app has focus.
  3. When the app closes, give XBMC the focus again.

Here are the contents of our launch-hulu.ahk file:

Run, %LOCALAPPDATA%\HuluDesktop\HuluDesktop.exe
WinWait, Hulu Desktop
WinActivate, Hulu Desktop
Process, WaitClose, HuluDesktop.exe
WinRestore, XBMC
WinActivate, XBMC
ExitApp

And of our launch-netflix.ahk file:

Run, windowsmediacenterapp:{e6f46126-f8a9-4a97-9159-b70b07890112}\{982ea9d3-915c-4713-a3c8-99a4688b7c59}?EntryPointParameters=
WinWait, Windows Media Center
WinActivate, Windows Media Center
WinWaitClose, Windows Media Center
WinRestore, XBMC
WinActivate, XBMC
ExitApp

Make note of where you saved both files, and open XBMC again. Navigate to your add-ons and select either Advanced Launcher or Executor (depending on what you installed earlier).

Follow the in-app prompts to create launchers for both Netflix and Hulu Desktop. I recommend watching this walkthrough for assistance doing so using Advanced Launcher.

Adding the launchers to your home screen

For each of the launchers you create, highlight them in the add-on menu and hit C on your keyboard. This will bring up a context menu. Choose to add the launcher to your favorites.

Now, go to your XBMC system settings and find the “Skin” section. Every skin is different, but if yours supports custom home screen entries, there should be some sort of “home customization” section. Look for a way to add a custom “favorites” item.

I’m using the Aeon Nox skin. When customizing the homescreen, I set “FAV1” and “FAV2” to my Netflix and Hulu launchers. Aeon Nox also lets me set custom backdrops, which I created especially for Netflix and Hulu.

Hulu in the Aeon Nox home screen

Enjoy (with caveats)

Hooray! Now you should be able to enjoy XBMC, Netflix and Hulu in harmony from the comfort of your living room. That said, there are some drawbacks to this solution…

  • Sometimes, Netflix will refuse to keep focus and the taskbar will be overlayed. This is a bug with Windows Media Center in general. It doesn’t happen often, and hitting the “start” button and launching Netflix again will fix the problem.

  • I ran into issues closing XBMC entirely and re-opening it on app exit, so in this case XBMC will remain open while Netflix and Hulu play in the foreground. This works fine for my setup which has a reasonably robust processor, but may be a non-starter for slower systems.

  • This is really for HTPC geeks only. If you want internet TV to “just work,” I recommend investing in an Apple TV, Xbox 360, PlayStation 3 or Roku.

If you have any suggestions on how I can improve my setup, please let me know!

Updates

March 19, 2013

Since the release of XBMC 12 “Eden,” I’ve tweaked my setup ever so slightly. Here are the relevant updates:

  • Executor is broken in XBMC 12, so you have to use Advanced Launcher now. Here’s an Advanced Launcher user guide I found helpful.

  • In a comment from last Summer, I recommended compiling the AutoHotkey scripts to executables so they’d work with Advanced Launcher. Recent versions now support Windows shortcuts (.lnk), so this is no longer necessary… just create a shortcut for each of the scripts.

  • After updating, WinActivate would no longer bring XBMC to focus. I ended up having to add WinRestore as well. The scripts in this post have been updated accordingly.

Responses

Jeff says

Thanks for the info as I’ve been looking for an easy way to watch netflix outside of XBMC. I’m running Vista on my HTPC and the netflix script doesn’t work. Any idea on how to tweak it?

Responded

Tyler Sticka says

Hi Jeff, sorry to hear the script isn’t working with you. I don’t have a Vista machine to test on, unfortunately. You may want to try steps 3 and 4 in this XBMC forum topic. If that doesn’t work, perhaps editing the Netflix launching script to match the paths in this article might alleviate your issues:

%windir%\ehome\ehshell.exe /entrypoint:{e6f46126-f8a9-4a97-9159-b70b07890112}\{982ea9d3-915c-4713-a3c8-99a4688b7c59}

If neither of those work, I would first try to create a simple Windows shortcut that can launch Netflix. If you can make that work successfully, try plugging the path you used into your AHK script. If that still doesn’t work, I encourage you to dive into the AutoHotkey docs to improve upon the script. Please share whatever solutions you find.

Responded

brandon says

Hey Tyler, thanks for the post. I think this is exactly what I’ve been looking for, although I feel like I am missing something. When I setup the launcher through adv launcher am I supposed to point it to the .ahk file or the actual hulu desktop executable? I don’t really understand how the hulu and netflix ahk files are used. Thanks again.

Responded

Tyler Sticka says

Hey Brandon, glad you dig the post.

You want to point your launchers to the launch-hulu.ahk and launch-netflix.ahk files. These scripts take care of launching the executables, giving them focus once they’ve launched, and re-focusing XBMC after they’ve been closed.

Let me know if that helps make sense of things or not.

Responded

brandon says

Hey Tyler, thanks for the reply. It looks like the advanced launcher will only let me point to a file with the .exe extension. Is there a way around this?

Responded

Tyler Sticka says

If AutoHotkey is installed, you can go into your Start Menu, go to the AutoHotkey program folder, and look for the “Convert .ahk to .exe” item. Refer to this page for more info.

Responded

Oog says

How would you modify the script to launch Internet Explorer and then return to XBMC when closed?

Responded

Tyler Sticka says

I would try using a similar script, but replacing the Run executable with Iexplore.exe and the Win titles with Windows Internet Explorer. See this thread for examples.

Every app has its own quirks. Be prepared to experiment and do a lot of guessing and checking till you get the experience you want.

Responded

Tad says

Hey Tyler, just want to say that this guide is awesome! This guide is the reason I finally made the leap from WMC+MediaBrowser to XBMC. Works perfectly. Thanks!

Responded

Tyler Sticka says

Hey, thanks! Always nice to hear I’m not the only one out there resigning myself to a bunch of disconnected, closed devices. :D

Responded

Tad says

I have a question for you. Not sure if you’re still tweaking any of this, but I figured I’d ask here as I’m smacking my head against the keyboard now.

I’m running into an issue where the Green Button will start XBMC using the AHK script you posted, but once the splash screen for XBMC comes up, it just hangs. I have to restart the computer. Have you run into an issue like this?

Once I restart, I have a scheduled task that runs XBMC after a 20 second delay. This works just fine with no issues. The other two scripts for Hulu and Netflix also work flawlessly. I added some volume control tweaks to improve the WAF. My wife no longer has to use the TV volume. It is just this one issue that has me puzzled.

Sorry for the long post. I ramble when I talk about this stuff.

Thanks again!

-Tad

Responded

Tyler Sticka says

That’s strange! I haven’t run across that issue myself.

If I were you, I would make a copy of launch-xbmc.ahk, then remove or comment out the first line (^+W::). This will allow you to run the script without the keyboard command, which may help you diagnose if the issue is something in the script itself or a conflict with the Green Button mapping that MCERemote established.

If this fixes the problem, then there’s probably an issue with how your PC is handling the Green Button or Control+Shift+Win shortcut. If the problem persists, then your machine must not like something in the rest of the script… I would try commenting out different portions (the WMC and Hulu checks, the IfWinNotExist wrapper, the WinRestore and WinActivate lines) to determine the culprit.

Unfortunately the best course of action at this point is tedious trial and error. Let me know what you find if you get a chance.

Responded

Tad says

All fixed! Turns out that the RUN statement for XBMC needed to be modified. I removed the 2nd of the two quoted strings, and it works now. Strange that it just started acting up like that though. Oh well, every system has some weird crap to deal with.

Thanks again!

Responded

Tyler Sticka says

No prob, glad you found a fix!

Responded

Steve says

Hi Tyler,

Love the article, thanks a ton, finally an option where I get to use xbmc and not have to deal with all the issues associated with the hulu/netflix plugins. One issue I am having, is that the launch-xbmc.ahk isn’t launching on my computer. The launch-hulu and launch-netflix are fine. Have you seen this before? I have copied and pasted to be sure to eliminate any typos.

I’m running Windows 7.

Responded

Tyler Sticka says

Thanks for the kind words, Steve!

Obviously there are a lot of potential points of failure with the launch-xbmc.ahk script compared to the other ones since the “Green Button” is such an idiosyncratic part of Windows and could get thrown off by what remote and receiver you’re using, etc.

If you’ve already used the MCERemote plugin to remap your remote to keyboard commands, then I would try a simpler script to verify that you’re capturing the command at all. Something like this might do the trick (haven’t tested it myself):

^+W::
MsgBox, Green Button pressed
return

This basically says “when Control + Shift + Win is pressed, show an alert box with some text.” If you run a script like that and it fails, your remote probably isn’t configured to send that command. If the script works and you see a message, then it’s the script itself that’s the culprit… maybe the window names are different on your machine?

Responded

CAJN says

Excellent guide and thanks for posting it! If you are still following this thread, I have a question concerning the Netflix + WMC script. When I use it, it goes into the WMC and starts Netflix just fine. However, what is the best way to exit? No matter which way I try, the AEON NOX skin goes to only background images and all the words are gone… The Hulu script does not do that, it exits cleanly and goes back into XBMC. Or is this a known issue?

Responded

CAJN says

Never mind, I have gotten it working properly. Just added a WinMaximize line towards the end of the script and it fixed the issue.

Responded

Tyler Sticka says

Glad to hear you found a solution, and thank you for sharing! I haven’t encountered that exact problem myself, but every setup has its own quirks.

Responded

Leave a response

Your email address won’t be published. You can use some HTML or Markdown.