<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Intercept a particular Notepad ++ instance]]></title><description><![CDATA[<p dir="auto">Hi, I need some advice. Let say we have two separate Notepad++ folder (portable):</p>
<p dir="auto"><code>A\notepad++.exe</code> (shortyly A)<br />
<code>B\notepad++.exe</code> (shortlby B)</p>
<p dir="auto">Both are run at the same time with <code>-multiInst</code> arguments. Step to reproduce:</p>
<ol>
<li>run A</li>
<li>run B &lt;&lt; let say this NPP was the last active</li>
<li>go to other window folder (or program)</li>
<li>do sth like this   <code>A\notepad++.exe -multiInst file.txt</code> (in console or through another program)</li>
</ol>
<p dir="auto">Our file will be open in B (not A) - it looks like due to recent activity on B. So my question is how can I intercept this situation? But without using any visual macro recorder, I need this in a more predictable way. I’ll just add that I can use Node.js or any other .exe if necessary (and of course inbuilt Windows tools.).</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/20056/intercept-a-particular-notepad-instance</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 23:20:55 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20056.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 25 Sep 2020 16:50:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Intercept a particular Notepad ++ instance on Sun, 27 Sep 2020 23:43:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/1978">@ArkadiuszMichalski</a> said in <a href="/post/57977">Intercept a particular Notepad ++ instance</a>:</p>
<blockquote>
<p dir="auto">I will try check two Firefox portable if such situation also appear for them.</p>
</blockquote>
<p dir="auto">Not sure why that is relevant.</p>
<blockquote>
<p dir="auto">If not then there will probably be something wrong with Notepad ++.</p>
</blockquote>
<p dir="auto">I don’t think you’re going to get much support in there being something “wrong with Notepad++” in this regard.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/57985</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/57985</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 27 Sep 2020 23:43:00 GMT</pubDate></item><item><title><![CDATA[Reply to Intercept a particular Notepad ++ instance on Sun, 27 Sep 2020 20:31:51 GMT]]></title><description><![CDATA[<p dir="auto">Btw, I will try check two Firefox portable if such situation also appear for them. If not then there will probably be something wrong with Notepad ++.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/57977</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/57977</guid><dc:creator><![CDATA[ArkadiuszMichalski]]></dc:creator><pubDate>Sun, 27 Sep 2020 20:31:51 GMT</pubDate></item><item><title><![CDATA[Reply to Intercept a particular Notepad ++ instance on Sun, 27 Sep 2020 20:02:08 GMT]]></title><description><![CDATA[<p dir="auto">Thx for some advice, I don’t have much knowledge about C ++ and windows API, that’s why I’m looking for a something already working. I have searched for some Node modules but haven’t done the tests yet.</p>
<p dir="auto">I correct in second post that in step 4 I don’t want use <code>-multiInst</code> (can’t edit here after some time!!!).</p>
<p dir="auto">Such selectting of the program dependent on the last one recently used (regardless of .exe) is the fault of Notepad++ or rather the default Windows behavior? I wonder if it could not be fixed somehow on the Notepad ++ side.</p>
<p dir="auto">In general, I also wonder if we can run in NPP a server (with a certain port) through plugin and send some tasks to it (from outside) to control its behavior. This would solve many of these problems. Maybe PythonScript can do that? Any ready module would be advisable?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/57975</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/57975</guid><dc:creator><![CDATA[ArkadiuszMichalski]]></dc:creator><pubDate>Sun, 27 Sep 2020 20:02:08 GMT</pubDate></item><item><title><![CDATA[Reply to Intercept a particular Notepad ++ instance on Sun, 27 Sep 2020 17:57:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/1978">@ArkadiuszMichalski</a> ,</p>
<p dir="auto">My experiments showed slightly different than you described: if in step #4 I use the <code>-multiInst</code> option again, it would add a <em>third</em> NPP window, but adding to the existing session from instance A.  <strong>&lt;edit&gt;</strong> oh, right, that’s what you already corrected in your follow-on post; sorry <strong>&lt;/edit&gt;</strong></p>
<p dir="auto">If my third run of Notepad++ was <em>without</em> the <code>-multiInst</code> option, the command line would attach the new file to whichever instance of Notepad++ was most recently accessed</p>
<p dir="auto">I tried renaming the executables: since I was using one portable 787 and one portable 788, I ended up naming them <code>npp787.exe</code> and <code>npp788.exe</code> – but even with different executable names, the file would attach to whchever NPP instance was most recently used, rather than the instance of the executable specified.  This is probably because both NPP instances register themselves the same with the Windows environment.</p>
<p dir="auto">In theory, if you could grab the hWnds for the individual Notepad++ instances, you could send a File Open (<code>NPPM_DOOPEN</code>) message to the right instance, rather than calling it with the executable.</p>
<p dir="auto">You might even be able to set up a PythonScript (or similar) notification handler that looks for an <a href="https://npp-user-manual.org/docs/command-prompt/#additional-options" rel="nofollow ugc">additional option after <code>-z</code></a> (and <a href="https://community.notepad-plus-plus.org/post/52805">the <code>-z</code> example</a> from <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a>) when the file-opening notification is handled, and have that handler determine whether it is the right instance, or whether it should try to pass it off to a different instance of Notepad++.  It would get complicated, but might be doable.</p>
<p dir="auto">(I am planning on having similar functionality in my perl module that remote-controls Notepad++ – see <a href="https://github.com/pryrt/Win32-Mechanize-NotepadPlusPlus/issues/27" rel="nofollow ugc">#27</a> and <a href="https://github.com/pryrt/Win32-Mechanize-NotepadPlusPlus/issues/32" rel="nofollow ugc">#32</a> – but it’s not implemented yet, because of the level of complexity I ran across while thinking about it, and I just haven’t found the right Round Tuit yet.)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/57974</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/57974</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sun, 27 Sep 2020 17:57:14 GMT</pubDate></item><item><title><![CDATA[Reply to Intercept a particular Notepad ++ instance on Sat, 26 Sep 2020 08:14:39 GMT]]></title><description><![CDATA[<p dir="auto">In step 4 I mean <code> A\notepad++.exe file.txt</code> (delegate file to proper opened instance).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/57938</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/57938</guid><dc:creator><![CDATA[ArkadiuszMichalski]]></dc:creator><pubDate>Sat, 26 Sep 2020 08:14:39 GMT</pubDate></item></channel></rss>