New commands for "run in browsers"



  • Hi there,

    For the security reason, 5 default customized shortcuts Launch in Firefox, Launch in IE, Launch in Chrome, Launch in Safari and Send via Outlook have been removed from the v7.6.4:
    https://github.com/notepad-plus-plus/notepad-plus-plus/commit/c1bf412f5737aa30f3f90ddaea57b2d8effbbea9

    It seems they are useful though. I’m restoring at least 3 commands Launch in Firefox, Launch in IE, and Launch in Chrome by doing a new implementation in v7.6.4.

    I would like to have your opinions/ideas for the places of these 3 commands (and new names) in current menu. Thank you in advance.



  • @donho

    How about having them back right where the used to be, with the same names they had? Unless there is a great reason for change, this makes “support” continuity easier… :)



  • @Alan-Kilborn said:

    How about having them back right where the used to be, with the same names they had

    Technically it’s difficult to do it, and also it’s rather the place for the customized macros and shortcuts commands.
    That’s why these new commands need a new place.



  • Another advantage to having them where they were (Run menu) is they can be tweaked by the user, or at the very least copied as a model. If they are “hardcoded” somewhere else, there is no tweaking/copying, and the burden of adding a new one (e.g. “Edge” seems popular) is all on the developer! :)



  • @donho

    i would put Launch in Edge to the list, instead of ie, as it has been requested a few times.

    the execution is via shell api:

    <Command name="Launch in Edge" Ctrl="yes" Alt="yes" Shift="yes" Key="69">shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge $(FULL_CURRENT_PATH)</Command>
    

    so it would be:

    • Chrome
    • Edge
    • Firefox

    (if you choose to minimise it to three options).

    the internet explorer can be added by the user to the run menu as usual.

    what do you think ?



  • @donho,

    Maybe put them in a submenu of the Tools menu, like Tools > Launch or Tools > Run Current File With…

    @Alan-Kilborn,

    I think the reason Don doesn’t want it in the customizable Run menu is because that came up in the EU-FOSSA review thingy. By doing it internally, there might be a way to check the “validity” of the browser before launching with it – though I sure don’t see how.

    Besides, even if it’s not active by default, as long as we still get shortcuts.xml to be able to add things to the Run menu (at our own risk), we can still advise people how to put them where they used to be, or add browsers that aren’t included by default in Notepad++'s internal list.



  • @donho

    @PeterJones wording of browser validation brings up a new idea in my head.

    feature: only list the launch in [browsername] options if the browser exists on that machine.

    so if someone does not have firefox.exe, the launch in firefox menu entry would be omitted.

    ps: would be a nice feature, but not a must have, as it is more difficult to implement.
    this way you could also put in more or all browsers, as users usually don’t have more than 2-3 installed.



  • @donho , All,

    Sorry if I’m missing or overlooking something but isn’t it better to have
    Launch in System Default Browser instead of all others?



  • @Alan-Kilborn

    Another advantage to having them where they were (Run menu) is they can be tweaked by the user, or at the very least copied as a model.

    The new commands are the normal commands like New, Close or Always on the Top, so there’s no way user can tweak them.

    “Edge” seems popular

    I don’t know yet how get Edge’s full file path in Win32 API. If you have any idea, please let me know.



  • @donho

    the command line for edge is:
    shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge $(FULL_CURRENT_PATH)



  • @donho

    ps: translated to c++, the microsoft edge browser call could be something like this:

    ShellExecute(NULL, "shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge", buf->getFullPathName(), NULL, NULL, SW_SHOW);
    
    // or
    ShellExecuteA(NULL, "open", "shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge", buf->getFullPathName(), prog2LaunchDir, SW_SHOWNORMAL);
    

    note: if you ask yourself, why the hell this dude (me 😉) wrote shell:Appsfolder ... in a command line !?!:
    you can not run MicrosoftEdge.exe directly, so you have to use the shell api.

    ps to @SinghRajenM : if you are around, did i get the c++ syntax half way right ?



  • @Meta-Chuh
    C++ syntax looks fine. 😊

    In my opinion your solution may work but does not look perfect (Note: this is my personal opinion which should not hurt you 😊).

    In past (around 2015 when edge was evolving) I have written code using COM to detect Edge is installed or not. But that time MS used to call Edge as spartan browser. I feel this stands true internally today as well, but not sure.

    Anyway, to launch Edge, we use command microsoft-edge: (without url) and microsoft-edge:htpp://www.google.com (with url) in run window.

    We can leverage the same in c++ like below -

    ShellExecuteA(NULL, "open", "microsoft-edge:http://www.google.com", NULL, NULL, SW_SHOWNORMAL);



  • @donho
    The Macros and Run commands store their entries in a single file (shortcuts.xml). Is it possible to divide this into two independent files?



  • @SinghRajenM

    Note: this is my personal opinion which should not hurt you 😊

    loool … don’t worry, every alternative that works will never hurt me, nor anyone with a goal to solve. 😉

    i benefit from your knowledge and passion, and in my mind you are very solution oriented.
    once you find something, you usually present a working alternative, together with an explanation, followed by a lot of proactive testing on your own initiative.

    this is much appreciated and one of the reasons why i enjoy to ask for your opinion. 👍



  • @Meta-Chuh I am so grateful for your generous words. It’s a special art which is not very common unfortunately. And we are fortunate that we have you with it.


Log in to reply