Hacking Windows 7 Media Center

Launching Background Commands from Extras Library

by Michael Healy @ 2:00 pm on December 4th, 2009 in plugins, programs with 7 Comments and Permalink

geany Looking for a way to launch commands or programs to run in the background from the Extras Library menu? When you may be in luck, CW-Kid and Andrew Cherry have come up with a .dll and a set of direction for doing just that. The process can be a little daunting for novices but if you’re looking for a way to run cmd files in the background you’re likely able to tackle the task. This can be especially useful for those looking to run mc2xml or that have setup batch files to process WTV to DVR-MS conversion. After following this guide you’ll have a handy little icon to launch the command from right inside Windows 7 Media Center.

To get started you’ll need to download the .dll file created by Andrew Cherry and extract it to the C:\Windows\ehome folder. This will handle the launching of the cmd file in the background. These cmd files are simple text files with the .cmd extension that can be written to do anything you can do from a standard command line interface, also known as a batch file.

Once you’ve got the .dll file extracted to the ehome directory and a batch file ready to run create a new xml file. Again this is a simple text file which can be created in any notepad application, simply save the file with the .xml extension and it’s an xml file. Copy the following into the new XML file:

<application title=”The title text that appears below the icon in Media Center
    id=”{25e1993f-a9d8-4251-871c-0bf84c6d6e29}”>
<entrypoint id=”{58267566-672b-4b1d-812a-fc46d728d073}”
    addin=”MissingRemote.AppLauncher.AddIn,     MissingRemote.AppLauncher,Culture=Neutral,Version=1.0.0.0,PublicKeyToken=391ca93ec5a00478″
    title=”The title text that appears below the icon in Media Center
    description=”Description text that appears below the icon in Media Center
    context=”%ProgramFiles%\foldername\name of your.cmd”
    imageUrl=”C:\Program Files\foldername\Images\your icon image.png”>
      <category category=”More Programs”/>
    </entrypoint>
</application>

Of course, you’ll need to alter the red text to match the title, description and location of your batch file as well as editing the location of a PNG image to use in the Extras Library as an icon. These images should be a square probably not needing to be any larger than 128px X 128px as Media Center will scale them appropriately for the resolution being used. Once you’ve got the XML file ready open an elevated command prompt (run –> cmd –> ctrl-shift-enter).

cmd

Inside the command windows change to the C:\Windows\ehome directory and enter the following command: registermceapp /allusers XMLFILE. Change XMLFile to the location that you’ve saved the XML file to and press enter to run the command. You should get a success message. If you don’t receive a success message it’s likely that you’re not inside an elevated cmd prompt, also for multiple new entries you’ll need to change the GUID and ID in the XML file (id=”{25e1993f-a9d8-4251-871c-0bf84c6d6e29}”>
<entrypoint id=”{58267566-672b-4b1d-812a-fc46d728d073}”
).

Once the XML data has been successfully entered into the registry launch Windows 7 Media Center and browse to the Extras Library.

extras library

That’s all there is to it! You should now see the icon for the program set in the XML file and pressing the icon should launch the cmd file in the background executing the set of commands inside. Thanks to CW-Kid for sharing this with the Media Center community! Be sure to stop by his blog and check out his many other guides and articles on Windows Media Center.

7 Comments


Rusty
Comment #5325 from Rusty [Reply]

It seems you can do the same thing with Media Center Studio by just creating a batch file and filling in the form for Insert Application. The program creates the entry points and xml and asks you to pick the icons. This seems to be easier and Media Center Studio allows you to control the function of your Media Center Start Menu Scripts.

I used your great guide for using Media Center Studio to Create Custom Themes and Start Menus located at http://www.hack7mc.com/2009/09/create-custom-themes-and-start-menus-with-media-center-studio.html to learn how to do this.

Comment left December 4, 2009 at 3:10 pm with Permalink
@Reply #5332 from Michael Healy [Reply]

Yeh, it’s always nice to have multiple ways to get something done though in case a certain combination doesn’t work well together.

Comment left December 4, 2009 at 5:09 pm with Permalink

Greg
Comment #5343 from Greg [Reply]

This might be a good method for people to use previously prepared scripts to rip dvds without leaving the WMC interface.

I’m going to try setting this up to process Lifehacker’s “One-click DVD rip” system that I already use.

Comment left December 4, 2009 at 9:28 pm with Permalink

Tom
Comment #5457 from Tom [Reply]

Is there STILL not a way to add pc game shortcuts to the extras menu?

Comment left December 7, 2009 at 6:11 pm with Permalink
@Reply #5479 from Michael Healy [Reply]

I was able to add an icon to launch games using MC Studio. Certainly using this method to launch games should also be possible though I haven’t tried it myself.

Comment left December 8, 2009 at 11:28 am with Permalink

EroSoft
Comment #5601 from EroSoft [Reply]

Just a question about the GUID and ID reported on XML file. If i would create multiple Icon/commands on Extras Library, so multiple XML files that point to a different .cmd batch, what i have to paste on ID tags ?
Can i use the same text i.e. (id=”{25e1993f-a9d8-4251-871c-0bf84c6d6e29} for all my .XML files ?

Thanks

Comment left December 11, 2009 at 8:44 am with Permalink
Comment #6456 from cw-kid [Reply]

Erosoft, no you need to use different GUID’s for each command you want to register, you can use a GUID generator, I just change the last two digits of the initial GUID I generated i.e.

25e1993f-a9d8-4251-871c-0bf84c6d6e29

would be come

25e1993f-a9d8-4251-871c-0bf84c6d6e30

for my second command I register and so on.

Andrew’s DLL just supresses a un-desired pop-up dialogue box in Media Center and you don’t actually need the DLL for the commands to be launched.

You can problably do this in Media Center Studio easier, I’ve not tried it however, but I was using this method long before Media Center Studio was even released!

Here’s my original post on this topic.

Comment left January 8, 2010 at 11:45 pm with Permalink

Leave A Comment

Post Anonymously, Fill in your details or Use one of the Social Networks below to login and post a comment!