Community
    • Login

    Controlling multiple instances of NOTEPAD++

    Scheduled Pinned Locked Moved General Discussion
    8 Posts 3 Posters 5.6k 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.
    • David BaileyD
      David Bailey
      last edited by

      I work from the command line, and invoke NP++ using the command

      NOTEPAD++ file

      (actually a use a batch file to save typing, but that isn’t the point)

      Successive uses of this command combine all the files into one instance of NP++, which is exactly what I want.

      However, sometimes I want to use the compare plugin, and this is most conveniently done in a separate instance that can be invoked using

      NOTEPAD++ -multiInst file1 file2

      This works fine - I have one instance of NP++ containing my sources, and another that is used exclusively to perform the comparison.

      However, if I edit yet another source file, there is a 50/50 chance that it will get added to the comparison instance - which is not where I want it.

      Ideally I would like a way to tell a particular instance of NP++ not to accept additional files (so that the other instance can accept them). I have my own custom plugin for a few features, so if anyone knows how to do this from within a plugin, that would do - though a simple command would be easier!

      David

      1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank
        last edited by Claudia Frank

        Hello David Bailey,

        I don’t know if this is convenient but what about renaming the npp,
        which should compare files only to something like comp_npp.exe
        and execute accordingly? Meaning you wil do a copy of npp and put
        it in the same directory where “normal” one is.

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • David BaileyD
          David Bailey
          last edited by

          Claudia,

          Thanks for your suggestion, but did you actually try this. I found that the npp_comp version of NOTEPAD++ was still capable of receiving additional files - it didn’t seem to make any difference :(

          David

          1 Reply Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank
            last edited by

            Hello David,

            to be honest, no - I couldn’t imaging that windows handles this different.
            Thought having two different process, as proven by task manager,
            should be enough but it looks like windows does something different under
            the hood.
            What I can see is, that the npp, which had the last focus, gets the new files.
            Maybe this is a way to handle it?
            Nevertheless I will try to find out what’s really going on here.

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 0
            • dailD
              dail
              last edited by

              Notepad++ has an internal mutex that checks to see if another instance is running, irregardless of the name of the executable.

              1 Reply Last reply Reply Quote 0
              • David BaileyD
                David Bailey
                last edited by

                Does a plugin get a chance to see the request to add another file, so it can veto it?

                I know that the file seems to go to whichever instance of NP++ is upermost (maybe most recently activated) but that is not a very convenient distinction to make in actual use.

                David

                dailD 1 Reply Last reply Reply Quote 0
                • dailD
                  dail @David Bailey
                  last edited by

                  @David-Bailey said:

                  Does a plugin get a chance to see the request to add another file

                  Yes

                  so it can veto it?

                  No :(

                  1 Reply Last reply Reply Quote 0
                  • David BaileyD
                    David Bailey
                    last edited by David Bailey

                    Dail,

                    Thanks for your help - I guess the final question is, can a plugin transfer a file to another running NPP instance?

                    Another solution would be a new command line option to stop that instance receiving additional files in this way.

                    I mean, the compare plugin is really useful, and it is nice to use it from within NPP rather than using a different tool. However it is easy to get in a tangle if you use it in conjunction with other editing tasks.

                    David

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