Google Search

Custom Search

Powered by...

Find us on Facebook

Wednesday 2 December 2009

How to launch a command file from within MCE

I saw a user on the Green Button asking this question the other day and as I had a method of doing this I thought I’d write a post about it.

There may well be different ways to accomplish the same thing, but this is what works for me and the way I get an icon into the Extra’s area of 7MC and when I click on it, it runs a command line in the background. (This also works on Vista)

First you need to download this little add-in here, then extract / save it to the C:\Windows\ehome directory.

This is a single .dll file that was written for me by Andrew Cherry so credit goes to him.

Next you need to create an XML file.

Below is an example of one of my XML files, that when registered in to Media Center, allows me to click on an icon in Media Center and have a VPN connection command run in the background.

<application title="UK VPN-1"
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="UK VPN-1"
description="Connects the UKVPN1"
context="%ProgramFiles%\RasDialPro\UKVPN1.cmd"
imageUrl="C:\Program Files\RasDialPro\Images\Connect-UK.png">
<category category="More Programs"/>
</entrypoint>
</application>

Open notepad and copy the text below in to it:

<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>

You need to change the items in red to suit your needs, my paths for this point to C:\program files, you can probably change the path to what ever you like and point it to the location of your .cmd file.

The icon images I use are 122 x 122 .png files.

Once you have finished editing your XML file give it an appropriate name and save it in to the C:\windows\ehome directory ensuring it has a .XML extension and not .txt.

Note: If you want to register more than one icon into Media Center by creating a second XML file, you will need to ensure you change the GUID ID’s on the id= and entrypoint id= lines. I normally just change the last two numbers to something else, for example:

id="{25e1993f-a9d8-4251-871c-0bf84c6d6e29}"> change to id="{25e1993f-a9d8-4251-871c-0bf84c6d6e30}">

<entrypoint id="{58267566-672b-4b1d-812a-fc46d728d073}" change to <entrypoint id="{58267566-672b-4b1d-812a-fc46d728d074}"

Now you need to register your XML file in to Media Center, open a command prompt (Run as Administrator), make sure you are in the C:\Windows\ehome directory then type registermceapp /allusers name of your.xml

Where name of your.xml is the filename you gave your xml file that you saved in the ehome directory earlier. Hit enter and you should see Success

image

Open Media Center go to the Extra’s library and your new icon should now be visible, click the icon and test that your command file is run?

To remove the icon you can use the command registermceapp /allusers /u name of your.xml

image

Well I think that’s everything, hopefully it will work for you as well.

Phaze1 Digital