Launch a program from W7MC main menu

mrsilver

Posts: 63
Joined: Mon Oct 20, 2014 5:01 pm
Location:

HTPC Specs: Show details

Launch a program from W7MC main menu

#1

Post by mrsilver » Wed Jun 28, 2017 6:35 pm

I'd like to add a main menu item in W7MC to run launchbox.

What is the recommended way these days to do this? I want it to sit in the main menu and when selected it should minimise W7MC, run launchbox and then maximise W7MC after it's closed. If W7MC suddenly becomes full screen, then launchbox (and any child processes) should be closed.

I'm not adverse to writing something myself, but pretty sure someone has done this kind of thing already.

I looked at Relaunch and it puts programs in the "extras" rather than the main menu and doesn't close the program (and child processes) if someone hits the Windows button on the remote. Meaning that the game will continue to run in the background, whilst W7MC has full screen focus.

Thanks!

jachin99

Posts: 1293
Joined: Wed Feb 24, 2016 3:36 pm
Location:

HTPC Specs: Show details

#2

Post by jachin99 » Wed Jun 28, 2017 7:11 pm

If you look at the relaunch source code, you can see that its just a collection of scripts. I'm thinking the minimize/maximize part is just an auto IT Script but here is a link to its homepage
https://github.com/chrishalebarnes/Relaunch
There is a link on that page that breaks down each part of the script. As far as registering to the start menu, essentially each start menu tile or strip is an xml file, and I think a registry entry. I've found a few different tidbits on how to do this with Vista so I'll share. I don't have time to play around with this a whole lot right now, or I would have tried already. I also use Launchbox but i subscribed and used BigBox.

Here are some Vista links, and I'll keep looking for Windows 7 info

https://blogs.msdn.microsoft.com/astebn ... ows-vista/
https://dottech.org/170884/how-to-add-a ... enter-tip/

mrsilver

Posts: 63
Joined: Mon Oct 20, 2014 5:01 pm
Location:

HTPC Specs: Show details

#3

Post by mrsilver » Wed Jun 28, 2017 8:19 pm

jachin99 wrote:I also use Launchbox but i subscribed and used BigBox.
Thanks for this. Funnily enough I'm actually going to purchase BigBox and it's going to be that which I want to call from W7MC!

Does that change the solution in any way? How did you do it?

jachin99

Posts: 1293
Joined: Wed Feb 24, 2016 3:36 pm
Location:

HTPC Specs: Show details

#4

Post by jachin99 » Thu Jun 29, 2017 12:52 am

I used relaunch because It isn't a huge deal to me but I would like to learn how to add new strips to the start menu. I got bigbox to launch WMC, and if you search on their forums for my name, you should see my posts about it. Basically launchbox lets you add custom programs games or emulators to their main interface but its not quite perfect yet. I just gold bigbox to launch ehshell.exe, and added my own artwork to a few folders. I haven't messed around with it too much because I'm trying to tweak some other programs right now, and like I said I don't get much time with my machines.

jachin99

Posts: 1293
Joined: Wed Feb 24, 2016 3:36 pm
Location:

HTPC Specs: Show details

#5

Post by jachin99 » Thu Jun 29, 2017 1:18 pm

So I found a page about adding menu strips to 7MC that I'll give you a link to right here https://msdn.microsoft.com/en-us/librar ... 89043.aspx I have a copy of the wmc sdk so I took a peak at some of the files that page references and they aren't anything too complicated. There are three files that I know of which are needed for adding a start menu strip with those files being a registry file, a Register.xml file, and the installation batch file. Just to make it easy, I'll post a plain text copy of what each of those files contain right here.

////REGISTRY File//////
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Start Menu\Applications\{9192c34d-2734-4d91-b37d-b1d000fb68f3}]
"Title"="Title.CustomStartMenu.1"
"Category"="MyCompany\\MyApplication1"
"OnStartMenu"="True"
"TimeStamp"=dword:0cc919b0

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Extensibility\Categories\MyCompany\MyApplication1\{e59f52ca-5440-41d3-aabf-d4e1ba53add4}]
"TimeStamp"=dword:0CC919AF

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Extensibility\Categories\MyCompany\MyApplication1\{29b8fe49-3741-469c-8d45-abc927ffbbd8}]
"TimeStamp"=dword:0CC919B0

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Extensibility\Categories\MyCompany\MyApplication1\{97de531e-9a8a-4faa-9f1f-bbb12fe70626}]
"TimeStamp"=dword:0CC919B1

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Extensibility\Categories\MyCompany\MyApplication1\{f5300c25-acc0-4854-b659-f71002dba97d}]
"TimeStamp"=dword:0CC919B2

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Extensibility\Categories\MyCompany\MyApplication1\{9ba5d566-8c2a-4bc1-b248-2f93a478b5be}]
"TimeStamp"=dword:0CC919B3

////INSTALLATION BATCH FILE/////
REM Usage: Install.bat
REM @ECHO OFF
%windir%\ehome\RegisterMCEApp.exe Register.xml /allusers
%windir%\ehome\RegisterMCEApp.exe Register.Application.1.xml /allusers
%windir%\ehome\RegisterMCEApp.exe Register.Application.2.xml /allusers
regedit /s Registry.Application.1.reg
regedit /s Registry.Application.2.reg

/////REGISTER.XML FILE ///////
<application id="{9192c34d-2734-4d91-b37d-b1d000fb68f3}" Title="Application.1.Title" Description="Application.1.Description" CompanyName="Application.1.CompanyName">
<entrypoint id="{e59f52ca-5440-41d3-aabf-d4e1ba53add4}" addin="Microsoft.MediaCenter.Hosting.WebAddIn,Microsoft.MediaCenter" title="title.start.app.1.1" description="description.start.app.1.1" imageURL = "Image.Start.App.1.1.png" context="http://play.mediacentersandbox.com/mcml ... fault.mcml">
<category category="MyCompany\MyApplication1"/>
</entrypoint>
<entrypoint id="{29b8fe49-3741-469c-8d45-abc927ffbbd8}" addin="Microsoft.MediaCenter.Hosting.WebAddIn,Microsoft.MediaCenter" title="title.start.app.1.2" description="description.start.app.1.2" imageURL = "Image.Start.App.1.2.png" context="http://play.mediacentersandbox.com/mcml ... fault.mcml">
<category category="MyCompany\MyApplication1"/>
</entrypoint>
<entrypoint id="{97de531e-9a8a-4faa-9f1f-bbb12fe70626}" addin="Microsoft.MediaCenter.Hosting.WebAddIn,Microsoft.MediaCenter" title="title.start.app.1.3" description="description.start.app.1.3" imageURL = "Image.Start.App.1.3.png" context="http://play.mediacentersandbox.com/mcml ... fault.mcml">
<category category="MyCompany\MyApplication1"/>
</entrypoint>
<entrypoint id="{f5300c25-acc0-4854-b659-f71002dba97d}" addin="Microsoft.MediaCenter.Hosting.WebAddIn,Microsoft.MediaCenter" title="title.start.app.1.4" description="description.start.app.1.4" imageURL = "Image.Start.App.1.4.png" context="http://play.mediacentersandbox.com/mcml ... fault.mcml">
<category category="MyCompany\MyApplication1"/>
</entrypoint>
<entrypoint id="{9ba5d566-8c2a-4bc1-b248-2f93a478b5be}" addin="Microsoft.MediaCenter.Hosting.WebAddIn,Microsoft.MediaCenter" title="title.start.app.1.5" description="description.start.app.1.5" imageURL = "Image.Start.App.1.5.png" context="http://play.mediacentersandbox.com/mcml ... fault.mcml">
<category category="MyCompany\MyApplication1"/>
</entrypoint>
</application>

In my ideal setup, there would be a dedicated start strip for games with a tile for different game categories

mrsilver

Posts: 63
Joined: Mon Oct 20, 2014 5:01 pm
Location:

HTPC Specs: Show details

#6

Post by mrsilver » Thu Jun 29, 2017 4:19 pm

I think I might have found the same page that you did. I'll have a play and see if I can get something that creates a new strip called "games" with bigbox in it.

If I can get that working then extending it should be reasonably easy.

jachin99

Posts: 1293
Joined: Wed Feb 24, 2016 3:36 pm
Location:

HTPC Specs: Show details

#7

Post by jachin99 » Thu Jun 29, 2017 9:25 pm

I'm not sure about your experience level, and I'm still new at this. The methods I'm pointing you towards need a GUID for I'm guessing the actual application and the "entry point" in the WMC newly created strip. I couldn't find a GUID for Big Box but I'm thinking just writing a console application that executes a command to start big box, and giving that a GUID might work. We would need a unique command for each game system, and a unique GUID. Feel free to share any input or experience you have on this

mrsilver

Posts: 63
Joined: Mon Oct 20, 2014 5:01 pm
Location:

HTPC Specs: Show details

#8

Post by mrsilver » Fri Jun 30, 2017 2:52 pm

For GUID there is a program you can use to create one, although it looks like something random will probably work as the chances of another MCE program having the same GUID is going to be extremely rare. I can code a launcher which starts BigBox and handles when it closes or loses focus back to W7MC no problem.

The good news is that I have a menu item strip with icon:

Image

The bad news is that when you click on it, it's supposed to just launch notepad.exe but, instead, I get the error "The Gaming program has stopped responding and you'll be returned to Windows Media Center", which isn't very helpful.

Code I'm using is as follows:

Bigbox.xml

Code: Select all

<application title="Gaming" id="{81E3517C-A5F3-4afa-9E37-81BF9A6A99FE}">

    <entrypoint id="{760A3CF3-6675-444b-AA31-B2A3F94AD9A3}"
		addin="Microsoft.MediaCenter.Hosting.WebAddIn,Microsoft.MediaCenter"
		title="LaunchBox"
		description="Game launcher"
		imageURL = ".\BigBox.png"
		run="c:\windows\system32\notepad.exe">
        <category category="MyCompany\MyApplication1"/>
    </entrypoint>
  
</application>
BigBox.reg

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Start Menu\Applications\{81E3517C-A5F3-4afa-9E37-81BF9A6A99FE}]
"Title"="Gaming"
"Category"="MyCompany\\MyApplication1"
"OnStartMenu"="True"
"TimeStamp"=dword:0c7e59de
I'll keep working on it...

jachin99

Posts: 1293
Joined: Wed Feb 24, 2016 3:36 pm
Location:

HTPC Specs: Show details

#9

Post by jachin99 » Fri Jun 30, 2017 5:19 pm

How does WMC know that its supposed be launching a Gaming progam, and not just some program? I'm in the process of building an entry point also. Maybe it assumes its a game because of where your putting the registry key. I have to dig up a few other registration and registry files, and see if I can find anything. Off the bat, I would say try moving your registry key to a new location. I'll share more in a little bit hopefully

jachin99

Posts: 1293
Joined: Wed Feb 24, 2016 3:36 pm
Location:

HTPC Specs: Show details

#10

Post by jachin99 » Fri Jun 30, 2017 5:52 pm

I dug up an old wmc plugin for nasa TV because even though the web feeds are broken, it still registers a new strip along with a few tiles on the start menu. Comparing what that program's installation adds to the registry to what is added to the start menu, here is what I see. NASA TV doesn't have a registry entry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Start Menu\Applications. Instead NASA TV, and I believe EMBY for WMC store their registry keys under [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\extensibility\Applications. Maybe try storing the key there instead?

mrsilver

Posts: 63
Joined: Mon Oct 20, 2014 5:01 pm
Location:

HTPC Specs: Show details

#11

Post by mrsilver » Fri Jun 30, 2017 9:28 pm

jachin99 wrote:How does WMC know that its supposed be launching a Gaming progam, and not just some program?
It doesn't, "gaming" was the title of the strip. As to it knowing what to run, that comes from the "run" value in the entrypoint element in BigBox.xml.
jachin99 wrote:Instead NASA TV, and I believe EMBY for WMC store their registry keys under [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\extensibility\Applications. Maybe try storing the key there instead?
Unfortunately that registry location appears to be for the items in "Extras" :(

I played around with the XML a little more and it definitely appears that the error message is generated from the title of strip in the Start Menu:

Image

Nothing seems to be working so I'm now looking at OpenPHT who have implemented a menu item and are open source.

jachin99

Posts: 1293
Joined: Wed Feb 24, 2016 3:36 pm
Location:

HTPC Specs: Show details

#12

Post by jachin99 » Fri Jun 30, 2017 10:07 pm

I got it working. I downloaded kodi for wmc integration, and modified the xml, and registry keys as necessary.

jachin99

Posts: 1293
Joined: Wed Feb 24, 2016 3:36 pm
Location:

HTPC Specs: Show details

#13

Post by jachin99 » Sat Jul 01, 2017 1:56 am

You can also use media center themer to add things to the start menu assuming that program still works. I'd still like to figure out how to do this programatically though

jachin99

Posts: 1293
Joined: Wed Feb 24, 2016 3:36 pm
Location:

HTPC Specs: Show details

#14

Post by jachin99 » Sat Jul 01, 2017 4:34 am

Just figured out how to change the name being displayed from kodi to something new. There is a registry key at hkeylocalmachine\software\Microsoft\windows\currentversion\mediacenter\startmenu\applications for what was originally the kodi integration app. You just change the title from kodi to whatever you want.

mrsilver

Posts: 63
Joined: Mon Oct 20, 2014 5:01 pm
Location:

HTPC Specs: Show details

#15

Post by mrsilver » Sat Jul 01, 2017 10:11 am

Oh nice one! Well done! I'll give it a go myself too.

As for rolling my own, I've still not managed to get it to launch anything so I'll provably ask on Superuser and see if someone know the answer. I'll let you know what I find out.

mrsilver

Posts: 63
Joined: Mon Oct 20, 2014 5:01 pm
Location:

HTPC Specs: Show details

#16

Post by mrsilver » Sat Jul 01, 2017 10:25 am

Worked well, although I was unable to change the icon and the text on the strip and icon.

mdavej

Posts: 1477
Joined: Mon Aug 20, 2012 6:52 pm
Location:

HTPC Specs: Show details

#17

Post by mdavej » Sat Jul 01, 2017 8:38 pm

Back when I used WMC, I just used Relaunch for NASA and other streaming sites. Worked fine and was slightly less complicated than what you're doing.

mrsilver

Posts: 63
Joined: Mon Oct 20, 2014 5:01 pm
Location:

HTPC Specs: Show details

#18

Post by mrsilver » Sun Jul 02, 2017 6:47 am

mdavej wrote:Back when I used WMC, I just used Relaunch for NASA and other streaming sites. Worked fine and was slightly less complicated than what you're doing.
Yeah, to be honest I wasn't expecting getting this working to be quite so difficult :(

To be honest, my biggest issue with Relaunch is that it puts all the items in the Extras menu - and I never go in there! :)

3rob3

Posts: 548
Joined: Sun Aug 28, 2011 8:48 pm
Location:

HTPC Specs: Show details

#19

Post by 3rob3 » Sun Jul 02, 2017 1:09 pm

When i was still using WMC, I used relaunch for various things. I am pretty sure once it adds the item you want to the Extras folder, you just right-click it and can pin it to the main menu. I can't remember the nomenclature but it worked.

jachin99

Posts: 1293
Joined: Wed Feb 24, 2016 3:36 pm
Location:

HTPC Specs: Show details

#20

Post by jachin99 » Sun Jul 02, 2017 3:40 pm

Relaunch doesn't create entirely new menu strips. The WMC menu has two components. A menu STRIP which are things like the TV strip, the Music strip, etc, and a Tile within each strip so Live TV would be a TILE. What the OP was asking about is creating a new menu strip dedicated to gaming related tiles. Relaunch creates tiles in the Extras menu strip because it can only create MCL files. What we have been doing so far in this thread is discussing how to make new tiles. Relaunch, I believe, also launches programs in the Eshell, which isn't a goal of the OP. I'm playing around with the idea of creating new menu strips right now without using the Kodi addon method discussed above because I don't think that's the best way to accomplish this, and it only places one strip with one tile on the start menu. Its confusing because there is a lot of missing documentation and there are a few different ways to accomplish the same goal, some of which work with older versions of WMC, and some of which work better on Win 7 WMC

Post Reply