The info below will give you the necessary information to add a button to Media Center to start Hulu, but do some other nice stuff along the way (like start a VPN and change the power scheme)
taskkill /IM "ehshell.exe"
ping 127.0.0.1 -n 20 -w 1000 > nul
powercfg -s 90729505-f061-4a2d-9304-adb0f3b267ab
rasdial "StrongVPN" username password
start /WAIT %LOCALAPPDATA%\HuluDesktop\instances\0.9.14.1\HuluDesktop.exe
rasdial "StrongVPN" /disconnect
powercfg -s 381b4222-f694-41f0-9685-ff5bb260df2e
start C:\Windows\ehome\ehshell.exe
Stepping through the file, this is whats happening:
taskkill /IM "ehshell.exe"
This juts kills Windows 7 Media Center - I don't want it to run in the background or else it will steal focus.
ping 127.0.0.1 -n 20 -w 1000 > nul
This pauses for 20 seconds (maybe there is a better way to add a wait command to a batch file, but this works) while Media Center shuts down.
powercfg -s 90729505-f061-4a2d-9304-adb0f3b267ab
This changes my power saving settings so that my screen doesn't turn off while I'm using Hulu (usually it will turn off after 15 minutes and Hulu doesn't stop it from doing so). To get the guids for your power saving settings for your computer use "powercfg -l" - create a new power saving profile that doesn't turn off the screen or computer first.
rasdial "VPN" username password
This starts the VPN connection.
start /WAIT %LOCALAPPDATA%\HuluDesktop\instances\0.9.14.1\HuluDesktop.exe
This starts Hulu - I have to use the .exe in the instance folder rather than the one in the HuluDesktop folder as all the one in the HuluDesktop folder does is run the one in the instance folder (and then the start /wait part of the command doesn't wait properly). I think I will have to update this location in the batch file whenever Hulu updates. The "start /wait" part of the command means the batch file doesn't continue until Hulu closes.
rasdial "VPN" /disconnect
Disconnects the VPN.
powercfg -s 381b4222-f694-41f0-9685-ff5bb260df2e
Returns the power saving settings to my normal power setting.
start C:\Windows\ehome\ehshell.exe
Start Media Center again now that it's all finished!
All I did then was store that file somewhere and create a shortcut to it in the C:\Users\MY USERNAME\AppData\Roaming\Media Center Programs folder. A crude looking shortcut now appears in the Media Center's Extras folder!
1 comment:
Adam,
Thanks, i have been searching for a solution like this for months.
Noam
Post a Comment