Add menu item to windows context menu only for text selection Add menu item to windows context menu only for text selection windows windows

Add menu item to windows context menu only for text selection


As per the last comment by @zionpi and the specification by @Math1000 stating "Specifically looking to convert LaTex to plain text", I am assuming that the OP is looking to add an option in the context menu for all strings(or text) displayed(or presented) by all and any applications running in the system, which allows the user to, as per the original question, open that particular selected string in explorer if it is a valid path in the system or, as per the added specification, convert that particular selected string to plain text if it is a valid LaTex code (by copying the converted LaTex code to clipboard, perhaps?).

While the validation of the selected text (to check whether it is a valid directory or LaTex code) and implementation of the operation succeeding the validation can be feasibly implemented without any difficulty, the context menu option requiring to be available for "ALL" texts displayed by "ALL" applications in the system is impossible to implement. This is because there is no way to alter the context menus of individual 3rd party applications as their context menus are regulated and controlled by the application itself by the nature of their source code during development and would require APIs released by the concerned application developers themselves to facilitate this demand.

One infamous application that allows the implementation of such behaviors is Office, for which you can build add-ons to customize certain aspects of the application (whose tutorials can be found here and here (for .NET interoperability)) to implement said requirements.

While irrelevant to the original requirement, it is worth looking into the shortcut menu handlers of the shell extension development process here as it is a better and a much more elegant way of adding/implementing right-click context menus in comparison to the way mentioned in the OP's question i.e. by editing the registry.