Controlling multiple instances of NOTEPAD++
I work from the command line, and invoke NP++ using the command
(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!
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.
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 :(
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
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.
Notepad++ has an internal mutex that checks to see if another instance is running, irregardless of the name of the executable.
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.
Does a plugin get a chance to see the request to add another file
so it can veto it?
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.