Click here to Skip to main content
15,867,299 members
Articles / Programming Languages / C#
Tip/Trick

Pin a Metro W8.0 Store App to the Taskbar

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
11 Jul 2013Ms-PL2 min read 14.1K   1
I wanted to pin a windows store app to the taskbar. This is not supported in W8.0.

Introduction

I wanted to pin a windows store app to the taskbar. This is not supported in W8.0. 

Script to Launch a Store App

After ample search I found a simple script on the internet to launch a store app, while the name app can be changed or be replaced by a parameter. Code in the script.vbs file:

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.SendKeys "^{ESC}"
WScript.Sleep 100
objShell.SendKeys "PlayMyMusicFolders"
WScript.Sleep 100
objShell.SendKeys "{ENTER}"

And voila!

So I made a shortcut to the script.vbs file, changed the Icon, pinned the shortcut to the taskbar and Voila! (that is almost French for ta-taah!) ... The chosen icon is not shown on the taskbar, but instead an ugly .vbs icon is shown.

I suppose there are more elegant solutions, but if you are a hammer you see nails everywhere, so I made a minimal C# program to run the script. Make a link to this program, change the icon and pin this shortcut to the taskbar and Joepie! (that is Dutch for Jippeeh!) it works.

RunScriptDotVbs to Run script.vbs

Program RunScriptDotVbs.exe is a C# console application with in program.cs:

C#
static void Main(string[] args)
{
  string cmd=  System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"Script.vbs");
   
  var start = new System.Diagnostics.ProcessStartInfo();
  start.FileName = cmd;

  try
  {
    var process = System.Diagnostics.Process.Start(start);
  }
  catch 
  {
    Console.WriteLine("No file Script.vbs found in current folder to run");
    Console.WriteLine("Hit <Return> to exit");
    Console.ReadLine();
  }
}

Points of Interest

  • The user experience of starting/switching to a Metro store app from the desktop using the taskbar is much better then using the startmenue or Win+Tab keys. However the number of such pins is limited. One could consider a JumplistLauncher for Metro Apps for a larger choice of items. Another option to consider: it is possible to start an app in a "snapped" state aside the desktop. Of course it is possible to write an app that is always in a snapped state.

  • We have a working solution with minimal open source, though other solutions are possible.
  • Launching is a little bit rough (the script does a search, app opens with a flip, a console window is opened).
  • I needed a pin to one app and I had the icon of the app, but maybe the icon finding and shortcut making could be automated.
  • This no brainer should be self-explanatory. Additionally RunScriptDotVbs.exe and the script.vbs for a specific app can be found here @PinPmmf2Taskbar(6kB).zip

  • The last step in writing this Tip/Trick was to give someone credit to the script. I read the link carefully and all the credit was given to AlKhuzaei who used C#. So in hindsight it is better to skip the script, use a C# program that takes one parameter and use something like:
    C#
    System.Windows.Forms.SendKeys.SendWait("^" + "{ESC}");           
    for (int i = 0; i < parameterLetters.Length; i++ )
    {
        System.Windows.Forms.SendKeys.SendWait(parameterLetters[i].ToString());
    }
    System.Windows.Forms.SendKeys.SendWait("{ENTER}");

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Netherlands Netherlands
Retired hobby programmer.

Comments and Discussions

 
GeneralAdditional Info: Attempt to add Keystrokes to enter the snapped state of the windows APP. Pin
wim4you13-Jul-13 1:17
wim4you13-Jul-13 1:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.