Expressions Shell Context Menu Idea

May 27, 2011 at 10:38 PM

I frequently need open XML files, with the single goal of copying some snippet from within the file, and creating a new document from it. My idea is leverage the Expressions Library to provide a Shell context menu, which would let you copy the results of an expression to the clipboard or a temp file.

In the case of a file, it could be launched and opened by the associated application. Default format would likely be UTF-8 text files, but there could be an option where we try to determine if the result is a qualified XML snippet. In which case it could be written out as an XML, or launched inside XML Explorer (which just goes without saying is likely your default for XML files anyways!).

The goal is to minimize the time it takes to:

  1. Open the file in XML Explorer
  2. Expand to the target node (hopefully you are using the Expressions anyways as bookmarks).
  3. Copy the node as XML.
  4. Create a new document from the clipboard (Ctrl+N).
  5. Possibly Save as.

While it is debatable how much time those context menus save, if they are complicated to navigate, I think a smart design could make this a very quick operation. Perhaps we could add a property to the saved expression, to control whether it should be included in the shell context menu?

The Shell menu would probably look something like a Winzip/Winrar cascading menu. If we allowed the user to flag the expressions to show in the shell context menu, this could be simplified to two levels.

  • Right click a file in Windows Explorer
    • XML Explorer
      • Copy to clipboard >
        • Expression 1
        • ...
        • Expression N
      • New file from > 
        • Expression 1
        • ...
        • Expression N

The question is how much of this could we do using C#, and would we need to dip into managed C++ for the shell extension. If anyone knows of a good managed library for providing shell context menus, please let me know. I'm going to research this and investigate it's viability.

May 27, 2011 at 10:52 PM

I'm thinking that we could leverage the Microsoft All-In-One Code Framework.