Community
    • Login

    View...How do I add browsers, so that I may run a program from different browsers.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    18 Posts 6 Posters 1.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Clyde DarbyC
      Clyde Darby
      last edited by

      How do I add browsers to Notepad ++ so that I may run code with different browsers

      PeterJonesP José Luis Montero CastellanosJ 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Clyde Darby
        last edited by

        @Clyde-Darby ,

        You cannot. That list of browsers is hardcoded into Notepad++'s application as a result of EU-FOSSA security reviews.

        However, the Run > Run menu allows you to run any command from your computer, with the arguments you supply it; and there is a list of “variables” here which allow you to pass information to those external programs. So do a Run > Run with command "c:\path to\browser\browser.exe" "$(FULL_CURRENT_PATH)" (yes, use the quotes) will run your chosen browser with the path to the active file – so as long as browser.exe takes a filepath as an argument to tell it to open that file in the browser, that should be sufficient. Save that to a named entry in the Run menu, and maybe assigning a shortcut, et voila, you have a “Run in MySuperBrowser” menu entry (and shortcut).

        Enjoy.

        JHV JHVJ Patrick 909P 2 Replies Last reply Reply Quote 3
        • JHV JHVJ
          JHV JHV @PeterJones
          last edited by

          @PeterJones - So… are you telling me that (the totally defunct / deprecated) IE is preferred over browsers such as Opera and Brave…? What about “Use Default Browser” in Windows ?? Let users decide what browser(s) to use - and not some EU-baloney!!
          “Run” is only good? for a few HTML files… not if you have many!

          PeterJonesP José Luis Montero CastellanosJ 2 Replies Last reply Reply Quote 1
          • PeterJonesP
            PeterJones @JHV JHV
            last edited by PeterJones

            @JHV-JHV ,

            are you telling me that […] IE is preferred over browsers such as Opera and Brave…

            I never said that, and I never would. But what is true is that the developers* decided to include those specific browsers, and left in methods for accessing others (ie, the Run menu)

            What about “Use Default Browser” in Windows

            Run > Run > cmd /c "$(FULL_CURRENT_PATH)" – This is exactly equivalent to double clicking a file in Windows File Explorer

            Let users decide what browser(s) to use - and not some EU-baloney!!

            Letting users run any command they want on the current file is exactly what the run menu is for.

            And EU-FOSSA isn’t baloney, especially since the primary developer lives in the EU.

            “Run” is only good?

            I am not sure what the question mark is doing there. I assume maybe you were trying to “ask a question” (though it’s poorly phrased), and then answer it in the same line, that follows after. I will simplify that to the assertion I believe you are trying to make by removing the ?:

            “Run” is only good for a few HTML files… not if you have many!

            I cannot see how any data supports this assertion. There is no difference between having to run Run > MySavedRunValue (or the keyboard equivalent) many times to open many files, compared to having to run the View > View Current File In > SomeBrowser the same number of times to open the same number of files in your browser.

            If you mean, “because I have to type the Run command every time”, then you did not understand that Run commands can be saved – permanently. I have run commands that I saved years ago, that I still use on a daily basis.

            Alan KilbornA 1 Reply Last reply Reply Quote 3
            • Alan KilbornA
              Alan Kilborn @PeterJones
              last edited by

              @PeterJones said in View...How do I add browsers, so that I may run a program from different browsers.:

              “Run” is only good for a few HTML files… not if you have many

              Probably the poster thinks they have to create one Run menu entry for each HTML file they might want to “view in browser”?? If so, it is certainly not true.

              1 Reply Last reply Reply Quote 4
              • José Luis Montero CastellanosJ
                José Luis Montero Castellanos @Clyde Darby
                last edited by José Luis Montero Castellanos

                @Clyde-Darby

                Cheers:
                This question was already partially answered above:

                You can copy the following line into your Npp root directory shortcuts.xml file.

                <Command name="Command description" Ctrl="no" Alt="yes" Shift="no" Key="116">C:\directory\browser.exe C:\directory\document.htm</Command>
                

                Replace in each part the description of what it does, the full path of the browser and the full path of the document

                <Command name="View in browser Opera-EN_en" Ctrl="no" Alt="yes" Shift="no" Key="116">C:\opera\opera.exe C:\My_projects\My_web_page.htm</Command>
                

                Ctrl="no" Alt="yes" Shift="no" Key="116" is the combination Alt+F5 shortcut,

                I think are free:
                Alt+F3
                Alt+F5
                Alt+F7
                Alt+F8
                Alt+F9

                You could use each keyboard shortcut for a different browser.
                Following an analogous method, I changed the operation of F1 to put the user manual help there.

                There may be $(CURRENT_FILE) to refer to the current or visible document in Npp… you just need to have saved it.

                Have a good day and success.

                PeterJonesP 1 Reply Last reply Reply Quote 0
                • José Luis Montero CastellanosJ
                  José Luis Montero Castellanos @JHV JHV
                  last edited by

                  @JHV-JHV
                  No offense:
                  ha ha ha … Windows couldn’t do with its IE what it did with Wordperfect when it programmed Word office because it was the support system. But hey, Edge brings it :)

                  1 Reply Last reply Reply Quote 0
                  • PeterJonesP
                    PeterJones @José Luis Montero Castellanos
                    last edited by PeterJones

                    @José-Luis-Montero-Castellanos ,

                    <Command name="Command description" Ctrl="no" Alt="yes" Shift="no" Key="116">C:\directory\browser.exe C:\directory\document.htm</Command>
                    

                    No! Please no! That’s exactly what the JHV was complaining about. You do NOT want to have to make a separate shortcut for every single file you might ever open in your browser!

                    The syntax I showed, where the Run command used is "c:\path to\browser\browser.exe" "$(FULL_CURRENT_PATH)" , is 100% the answer that @Clyde-Darby should use.

                    By using the Run dialog’s Save button, Clyde won’t have to go mucking about in the shortcuts.xml – you can just save the shortcut after pasting it into the field and then hitting Save and giving it a meaningful name.
                    eebd7724-a019-404f-afa4-241c6c126c9f-image.png
                    f9462622-a258-4116-bd4c-5205ecbbf60f-image.png
                    (The Save->Shortcut dialog even allows you to pick the keyboard shortcut. Which is again, so much easier than the mucking about in shortcuts.xml.)

                    You continue,

                    There may be $(CURRENT_FILE) to refer to the current or visible document in Npp… you just need to have saved it.

                    That’s half true. But $(CURRENT_FILE) does not contain the full path to the file. And browser.exe cannot know what the “current directory” is for Notepad++. So if you tried that, browser.exe would complain that it couldn’t find document.htm. To get around that, use the $(FULL_CURRENT_PATH) variable that I already showed. And the quotes are put around it because $(FULL_CURRENT_PATH) may have spaces in it

                    All the $(...) variables available to the Run menu are described in the usermanual here.

                    José Luis Montero CastellanosJ JHV JHVJ 2 Replies Last reply Reply Quote 1
                    • José Luis Montero CastellanosJ
                      José Luis Montero Castellanos @PeterJones
                      last edited by José Luis Montero Castellanos

                      @PeterJones
                      You are right you cannot create a command for each document, I just put it as an example, which I adjusted by referring to the variable $(CURRENT_FILE). And I’m glad to get the clarification regarding the use of “$(FULL_CURRENT_PATH)”. I thought to edit it so as not to confuse, or leave it as it is with the inaccuracy, so that your comment and mine make sense and be honest.

                      We always learn something. :)

                      PeterJonesP 1 Reply Last reply Reply Quote 0
                      • PeterJonesP
                        PeterJones @José Luis Montero Castellanos
                        last edited by

                        @José-Luis-Montero-Castellanos said in View...How do I add browsers, so that I may run a program from different browsers.:

                        I thought to edit it so as not to confuse, or leave it as it is with the inaccuracy,

                        It is generally considered rude to change the meaning of a post after people have replied to that post. Please do not change that previous post at this point.

                        so that your comment and mine make sense

                        This is one of the reasons that it’s considered rude to change a post that has replies: changing the meaning of a conversation is a bad idea, because it will confuse all future readers (including you, when you come back days or weeks or months later and wonder why someone replied the way they did when you’ve forgotten that you edited it)

                        José Luis Montero CastellanosJ 1 Reply Last reply Reply Quote 2
                        • José Luis Montero CastellanosJ
                          José Luis Montero Castellanos @PeterJones
                          last edited by

                          @PeterJones
                          Understood… :¬)

                          1 Reply Last reply Reply Quote 0
                          • JHV JHVJ
                            JHV JHV @PeterJones
                            last edited by

                            @PeterJones …I understand the difference between the two : C:\directory\browser.exe C:\directory\document.htm -and- c:\path to\browser\browser.exe" "$(FULL_CURRENT_PATH)

                            “?” meaning -> the “best practice” is to let users choose their default browser (under “View Current File In”) and not to micromanage browser choice which seems to be the main argument for the “Run”-thing. It’s the “logic” which eludes me! Why would a thing e.g. like “Use Default Browser” have to be emulated by the “Run” command…?
                            Now, I didn’t read any of all this EU-FOSSA crap… but you don’t honestly believe that the EU actually advocates for using IE in the year 2022… do you :-?

                            Correct me if I’m wrong here, but IE was completely removed in Windows 11…? You already got MS-Edge to somewhat emulate the behavior of IE, if needed…?
                            IE ought to be replaced by “Use Default Browser” - and you would pretty much cover most browser cases, used today, and in the easiest manner there is!
                            There are probably other people struggling with this too…

                            PeterJonesP José Luis Montero CastellanosJ 2 Replies Last reply Reply Quote 0
                            • Alan KilbornA
                              Alan Kilborn
                              last edited by

                              Reference:

                              4f684074-070a-4bec-ad2e-101d5919b29a-image.png

                              It certainly seems reasonable that a “Default Application” choice could be added above Firefox, perhaps with a menu separator between the two.

                              One of Notepad++'s strengths is that it will run on older systems, and perhaps a lot of these older systems have IE or even Firefox on them. So it does no harm to keep these menu entries.

                              1 Reply Last reply Reply Quote 2
                              • PeterJonesP
                                PeterJones @JHV JHV
                                last edited by PeterJones

                                @JHV-JHV said in View...How do I add browsers, so that I may run a program from different browsers.:

                                but you don’t honestly believe that the EU actually advocates for using IE in the year 2022… do you :-?

                                You don’t honestly believe I said that, do you?

                                You are fighting at strawmen, and not listening to my replies. After this post, I am done with this discussion.

                                IE ought to be replaced by “Use Default Browser”

                                Like Alan, I think “Use Default Browser” should be added to the list. But for that to happen, someone would have to make a polite feature request in the right location.

                                Alan KilbornA 1 Reply Last reply Reply Quote 3
                                • José Luis Montero CastellanosJ
                                  José Luis Montero Castellanos @JHV JHV
                                  last edited by José Luis Montero Castellanos

                                  @JHV-JHV
                                  Greetings from Colombia:

                                  IE ought to be replaced by “Use Default Browser” -

                                  Totally agree, if my preferred browser “then the default” is called let’s say “Anonymous” and other users’ “defaults” have 15 different names , an option like this would cover them all!, including IE for older systems.

                                  Now if I need a range of browsers to see IF my page is displayed in each of them, (matter that seemed to me the essence of this request for help!) then the use of RUN command is a good option, but I think it is less extensive. Since the leftover and contiguous keyboard shortcuts are reduced, not listed and memorizing them is not simple.

                                  Another option would be that the list in View > view current file in… be more extensive or editable (expandable), but including Default Browser… (NOTE: it is not a request!!!).

                                  Personal opinion: That is why traditional browsers that claim to respect our privacy, are the first to violate it, updating when they feel like it, for example.

                                  Have a nice day and success…

                                  1 Reply Last reply Reply Quote 0
                                  • Alan KilbornA
                                    Alan Kilborn @PeterJones
                                    last edited by

                                    @PeterJones said in View...How do I add browsers, so that I may run a program from different browsers.:

                                    Like Alan, I think “Use Default Browser” should be added to the list

                                    Note that Alan didn’t say Default Browser, Alan said Default Application.

                                    While apparently this View Current File in top-level menu has been used for browsers in the past, not everyone edits html or other web content.

                                    Default Application would be the equivalent of what happens when one invokes the Run dialog like this:

                                    18b2dc0d-3dc1-4b0b-a90d-709e6cfeb82e-image.png

                                    1 Reply Last reply Reply Quote 3
                                    • Alan KilbornA
                                      Alan Kilborn
                                      last edited by

                                      I think “Use Default Browser” should be added to the list

                                      Default Application would be the equivalent of what happens when one invokes the Run dialog like this…

                                      There’s also:

                                      a82e3675-845f-407c-9a1d-a0555a16865b-image.png

                                      which, for a .html or other “web file” associated with a browser, would effectively be “Open in Default Browser”.

                                      So, developers would probably push back (as redundant) on adding “Use Default Browser” to the View Current File in menu.

                                      1 Reply Last reply Reply Quote 3
                                      • Patrick 909P
                                        Patrick 909 @PeterJones
                                        last edited by

                                        @PeterJones

                                        perfect!

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post
                                        The Community of users of the Notepad++ text editor.
                                        Powered by NodeBB | Contributors