Decorum for the Forum:
  • Be nice. If you want to be mean, try Reddit.
  • No Piracy. If you want to be a thief, there are dark places on the internet dedicated to that.
  • No Cracking. Discussions on AnyDVD, DeUHD, DVDFab, UHDKeys and similar tools are not permitted here.
  • No Spamming. If you want to make a buck, work smarter... somewhere else.
  • No Adult Content. Half the internet is dedicated to adult content. This half isn't.

Privacy Policy: Click Here to Review (updated September 30, 2020)

How to add Win10 Apps as External Links

Helpful advice for getting the most out of Chameleon MediaCenter
Post Reply
User avatar
Pauven
Posts: 2861
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

How to add Win10 Apps as External Links

Post by Pauven » Fri Aug 23, 2019 10:14 am

Windows 10 Apps are different than normal programs you install on your Windows PC. They live in hidden folders that are impossible to browse to unless you already know the folder path, they use a definition file that controls how they launch and display, sometimes they have a command line shortcut to launch them, but usually they can only be launched by a very long, convoluted command line.

While none of that matters when you're using the Windows GUI to launch apps, CMC's External Links feature requires a command line to launch programs, including Windows 10 Apps.

Below is a process I've gleaned from the web, and distilled down to what is needed for CMC.


Install the Windows 10 App
If you haven't already, the first step is to install the app from the Windows 10 store. All of the steps below will fail if you have not already installed the app you want CMC to launch.


Check for a Shortcut
The next step is to see if there is a shortcut. For example, the Netflix app has a shortcut. To access that shortcut, you go to a command prompt (run CMD.exe, an easy way to do this is with the Windows hotkey WIN+R then enter cmd.exe), then run:

Code: Select all

start Netflix:
*NOTE: Notice the colon : at the end of the command, it is required for all shortcuts!

And Netflix starts right up (well, assuming you actually had the Netflix app installed). Some apps have a non-working shortcut, like Pandora, as doing a "start pandora:" starts the app, which then immediately crashes. So obviously you'll want to make sure that the shortcut actually works.

Not all apps have a shortcut, and even for the ones that do, I'm not sure how you determine what the shortcut value is that you need to use. All I can recommend is a guessing game. For example, if you are trying to discover the shortcut for the Pandora Music app, you might try various values like this:

Code: Select all

start pandora:
start pandoramusic:
start pandora-music:
start pandora_music:
start pandoraapp:
start pandora-app:
start pandora_app:
With each one you'll probably get a prompt like the following, with Windows indicating that you'll need an app and offering to search for it in the Mircrosoft Store - this means that the shortcut you tested doesn't work, so keep testing other values.
image.png
image.png (15.02 KiB) Viewed 12250 times

You might also get an error message like this, which also indicates the shortcut you tested doesn't work:
image.png
image.png (9.89 KiB) Viewed 12250 times

If you don't get lucky, you may want to do a quick google search, i.e. "start Win10 app pandora command line", as someone else may have discovered the shortcut and posted it for you. But don't get your hopes up, as in my experience only about 1 in 5 apps seem to have a working shortcut.

If you do get lucky with a working shortcut, the app will open up. In that case you're done, and you can use that shortcut directly in CMC. To use a Win10 App shortcut in CMC, you would need to set:

Code: Select all

Exe = %windir%\system32\cmd.exe
Exe Params = /c start netflix:
Of course, you would replace netflix with the shortcut that you discovered for your app.

If you didn't get lucky and find a shortcut, then you'll need to follow the longer process below.


Finding the Shell Launch Parameters
While the shortcut method described above may only work for 1 in 5 apps, the Shell launch method works for all Windows 10 apps. It takes quite a few steps to find the launch parameters, but the steps aren't too hard so just take them one-by-one and you'll be fine.

1) Open a command prompt (run CMD.exe). An easy way to do this is with the Windows hotkey WIN+R then enter cmd.exe.

2) Enter the following command:

Code: Select all

powershell get-appxpackage >123.txt
That will create a file named 123.txt in your user directory. Note that you could use whatever filename you want if you don't like 123.txt, though 123.txt is a good choice as it sorts alphabetically to the top making it easier to find in step 4 below.

Also note that the 123.txt file will only contain currently installed apps. If in the future you install a new app and want to launch it with CMC, you'll need to redo this step to recreate the 123.txt file with new data.

3) In Windows, browse to your user directory, i.e. C:\Users\<YourUserName>, replacing <YourUserName> with the Windows user with which you are currently logged in. For example I go to C:\Users\Paul, since Paul is my Windows username.

4) In your user directory, find the 123.txt text file you just created in step 2. Open that file, then find the app you're working on in the list of installed apps. In most text programs, you can do a CTRL+F to open a search window, then put the name of the app you're searching for. Once you find it, you will need to get 2 values: InstallLocation and PackageFamilyName. For example, here are those 2 values for Pandora:

InstallLocation : C:\Program Files\WindowsApps\PandoraMediaInc.29680B314EFC2_13.0.39.0_x64__n619g4d5j0fnw
PackageFamilyName : PandoraMediaInc.29680B314EFC2_n619g4d5j0fnw


5) Take note of the PackageFamilyName, you will need to use it later to launch the app from the command line (Step 8b below).

6) Copy the InstallLocation path (starting at C:\Program Files\…, highlight the path and do a CTRL+C to copy), then press WIN+R to open a run prompt, then CTRL+V to paste the filepath you just copied, then press OK:
image.png
image.png (18.28 KiB) Viewed 12250 times

This will open up the hidden folder. *NOTE: do NOT try to browse to that folder using Windows File Explorer starting from C:\Program Files\ as the WindowsApps folder is completely blocked from being browsable. The ONLY way to get to the hidden app folder is to use the steps above to open the target folder directly.

7) In this folder, open the file named AppxManifest.xml (you can typically double-click it and Windows will open it with Internet Explorer):
image.png
image.png (45.81 KiB) Viewed 12250 times

When you open the file you will see the manifest XML data. It may look overwhelming, but don't worry, you only need one piece of info from it, and it's easy to find. Following along in the screenshot below, first look for a tag named <Applications>, then right below it you will find another tag named <Application with a bunch of values inside of it. It may look different than the screenshot below, but regardless it should have a property named Id in it. Usually this Id value will be "App", but it can be anything. Take note of this value:

image.png
image.png (267.09 KiB) Viewed 12250 times

8) Finally you have everything you need to launch the Windows 10 app from the command line. To test it, follow these steps:

a) Open a command line (WIN+R, cmd.exe)
b) The command to launch a Win10 app has the following structure:

explorer shell:appsFolder\<PackageFamilyName>!<Id>

You will need to replace PackageFamilyName with the value you found in the 123.txt file, and Id with the value you found in the AppxManifest.xml file, like this:

explorer shell:appsFolder\PandoraMediaInc.29680B314EFC2_n619g4d5j0fnw!App

Enter that command at the command prompt and press ENTER, and the Windows 10 App should launch.

9) Now that you've validated the command works to launch the app, here's what you need to use in the custom CMC External Link definition:

Code: Select all

Exe = %windir%\system32\explorer.exe
Exe Params = shell:appsFolder\PandoraMediaInc.29680B314EFC2_n619g4d5j0fnw!App
The example above is for Pandora, please use the PackageFamilyName and Id values that you just tested in step 8b.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Post Reply