<?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[Using the PythonScript plugin to automate N++]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/83293">Finding available shortcut keys (originally “Where’s the ‘New Window’ command?”)</a>:</p>
<blockquote>
<p dir="auto">This discussion has stopped being about “new window” or about “shortcut keys”</p>
</blockquote>
<p dir="auto">Agreed, and I apologize for not starting a new topic sooner, but …</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/83293">Finding available shortcut keys (originally “Where’s the ‘New Window’ command?”)</a>:</p>
<blockquote>
<p dir="auto">and really ceased even being about Notepad++.</p>
</blockquote>
<p dir="auto">… I’d have to disagree with this assessment, since Python (despite being a third-party plugin) seems to be the preferred/default scripting solution for N++.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/83281">Finding available shortcut keys (originally “Where’s the ‘New Window’ command?”)</a>:</p>
<blockquote>
<p dir="auto">It seems we’re teaching Python??</p>
</blockquote>
<p dir="auto">Also agreed, but my questions have been mostly about the interaction of Python with N++, and I don’t know of any better forum to pose such questions.</p>
<p dir="auto">I created this thread (with a more appropriate title) as a place for future automation questions to be addressed.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/83288">macro to find/replace in current directory?</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rorso" aria-label="Profile: rorso">@<bdi>rorso</bdi></a></p>
<p dir="auto">Cool that that technique can work for you.  I had another idea which as “heavier” as it involved using a scripting plugin, so if that wouldn’t work out for you, I’d’ve gone down that road.</p>
</blockquote>
<p dir="auto">So if and when you go down that road, maybe you can post about it here.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/24013/using-the-pythonscript-plugin-to-automate-n</link><generator>RSS for Node</generator><lastBuildDate>Tue, 09 Jun 2026 21:14:03 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/24013.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 14 Jan 2023 01:49:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Mon, 10 Apr 2023 10:17:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tbugreporter" aria-label="Profile: TBugReporter">@<bdi>TBugReporter</bdi></a> said in <a href="/post/85614">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">I’m not sure whether you’re way overthinking this, or I’ve way underestimated the possibilities</p>
</blockquote>
<p dir="auto">I don’t know…  You posed a fairly reasonable desire, and I put some reality onto some potential problems with getting to where you wanted to go.</p>
<p dir="auto">Better to expose the “real world” of it, if it is known, before trying to solve the problem…, which we are now NOT going to do. :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85618</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85618</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 10 Apr 2023 10:17:43 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Mon, 10 Apr 2023 04:05:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/85595">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">here’s one scenario</p>
</blockquote>
<p dir="auto">I’m not sure whether you’re way overthinking this, or I’ve way underestimated the possibilities - probably both.</p>
<blockquote>
<ul>
<li>user is seeing the <em><strong>first</strong></em> tab (leftmost) in that docked panel</li>
</ul>
</blockquote>
<p dir="auto">Yeah, I hadn’t considered the possibility that other tabs might be present.</p>
<blockquote>
<p dir="auto">it depends upon how much work one would want to put into it.</p>
</blockquote>
<p dir="auto">Honestly, not that much in my case.  This now looks like a big can of worms that I don’t want to open.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85614</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85614</guid><dc:creator><![CDATA[TBugReporter]]></dc:creator><pubDate>Mon, 10 Apr 2023 04:05:14 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Sun, 09 Apr 2023 13:34:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tbugreporter" aria-label="Profile: TBugReporter">@<bdi>TBugReporter</bdi></a> said in <a href="/post/85593">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">detect whether the PythonScript console is currently being displayed?</p>
</blockquote>
<p dir="auto">I requested such a capability <a href="https://github.com/bruderstein/PythonScript/issues/274#issuecomment-1378860632" rel="nofollow ugc">HERE</a>; thus far it appears the developers haven’t  thought of it as a valuable enough feature to implement.</p>
<hr />
<blockquote>
<p dir="auto">so that when I’m done, I can put things back the way they were before</p>
</blockquote>
<p dir="auto">I’m struggling a little with what this might mean, or at least the value in it.</p>
<p dir="auto">If you are going to put something in the console window, then make sure it is shown to the user, what good is not showing it (e.g. “putting it back” if not-shown before) when the script has finished?</p>
<p dir="auto">Maybe the circumstance is some Tk interactive UI, where, as the user interacts with it, the console might be shown with updated data at certain points, then when the Tk UI is exited, the desire is to no longer show the console (“put things back”).</p>
<p dir="auto">And in the end, it may not be reasonable to put things entirely back.  If, say, the PS console has never before been opened; here’s one scenario:</p>
<ul>
<li>PS console, when opened, will join a group of existing tabs in a docked panel (hasn’t been opened yet, though, in this scenario)</li>
<li>user is seeing the <em><strong>first</strong></em> tab (leftmost) in that docked panel</li>
<li>user commands that the PS console should open</li>
<li>PS console opens as the <em><strong>fourth</strong></em> (and rightmost) tab in the docked panel</li>
<li>user command that the PS console should close</li>
<li>N++ restores the <em><strong>third</strong></em> (now rightmost) tab in the docked panel</li>
<li>user wonders what happened as things aren’t quite “put back” (now looking at third tab contents instead of first tab)</li>
</ul>
<p dir="auto">In summary, it is all possible to achieve, but it depends upon how much work one would want to put into it.  I could give some pointers on what I’d presume are the steps, but, as an in-depth treatment for this doesn’t interest me personally, I’m not going to code the whole thing up.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85595</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85595</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 09 Apr 2023 13:34:06 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Sun, 09 Apr 2023 07:39:12 GMT]]></title><description><![CDATA[<p dir="auto">Is there a way for PythonScript to detect whether the PythonScript console is currently being displayed?  I know I can <code>.show()</code> or <code>.hide()</code> it, but can I detect its condition <em>before</em> I start messing with it, so that when I’m done, I can put things back the way they were before my program was run?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85593</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85593</guid><dc:creator><![CDATA[TBugReporter]]></dc:creator><pubDate>Sun, 09 Apr 2023 07:39:12 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Fri, 24 Feb 2023 07:42:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/84364">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">Are you saying that infamous help site is version shaming you?</p>
</blockquote>
<p dir="auto">Well, yeah, in at least one case where I tagged the <a href="https://stackoverflow.com/questions/75317491/whats-the-proper-way-to-disable-widgets-in-python-tkinter#comment-132901984" rel="nofollow ugc">post</a> as <code>python-2.7</code> instead of plain <code>python</code> - but worse than that, the question was closed by a <strong>bot</strong> that referred me right back to the answer that I was failing to understand.</p>
<blockquote>
<p dir="auto">PythonScript 2.0.0 using Python 2.7.18 is the most recent non-beta release of the <em>plugin</em>.</p>
</blockquote>
<p dir="auto">I’m aware of that - it just seems that the maintainer must be needing some help if it’s taking ~3 <strong>years</strong> to move everything to Python 3.  (Unfortunately, as I explained about my Internet identity, I can’t offer much help in that regard, and there apparently aren’t many people who can.)</p>
<blockquote>
<p dir="auto">my first web search  brought me to <a href="https://stackoverflow.com/questions/6666882/tkinter-python-catching-exceptions" rel="nofollow ugc">this</a></p>
</blockquote>
<p dir="auto">Yes, I’ve been bouncing around the pages linked from that page for several days now, but I’m no closer to adapting those examples to my situation.  I’m sure part of the problem is that I’ve been coding since long before “object oriented” was a thing, and I still can’t wrap my Neolithic brain around “classes” and such - but another part is that those examples all seem to want to bring the exception (in my case, it’s <strong>not</strong> an error message) to the console, and I’m specifically looking to <strong>avoid</strong> spewing all that red text in the user’s face.</p>
<blockquote>
<p dir="auto">PythonScript […] should be able to properly throw an exception</p>
</blockquote>
<p dir="auto">Agreed.  The Python docs say that Tkinter handles exceptions very differently than regular Python, but there’s no explanation of how a Python coder needs to adapt their code to the differences.  (Maybe if I keep running into these walls a bit harder, I’ll start to enjoy it more. 😵‍💫)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84390</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84390</guid><dc:creator><![CDATA[TBugReporter]]></dc:creator><pubDate>Fri, 24 Feb 2023 07:42:53 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Fri, 24 Feb 2023 07:39:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/84364">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">so I don’t know what milestone it wants to hit before transitioning out of beta</p>
</blockquote>
<p dir="auto">I assume this one</p>
<pre><code>Missing features:
    support for files with encodings that are not unicode
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/84389</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84389</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Fri, 24 Feb 2023 07:39:54 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Thu, 23 Feb 2023 14:07:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tbugreporter" aria-label="Profile: TBugReporter">@<bdi>TBugReporter</bdi></a> said in <a href="/post/84361">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/84355">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">The overflowing stack of code writers don’t have such a restriction that I know of.</p>
</blockquote>
<p dir="auto">I guess I’m not looking for this knowledge in the right places, then.</p>
</blockquote>
<p dir="auto">Are you saying that infamous help site is version shaming you?  Wow, they are less helpful than I remembered… but I’ve never tried asking a Python question there.</p>
<blockquote>
<blockquote>
<p dir="auto">You complained to us about an old version of PythonScript in Plugins Admin, but the screenshot highlights that you’re actually wondering about the old version of the Python interpreter that’s part of PythonScript Plugin.</p>
</blockquote>
<p dir="auto">Okay, but putting that particular credit front and center made me question whether I’m really using Python 2 or 3 when running my “scripts”.  (I know that I shouldn’t be calling them that, but I’m trying to go with the flow.)</p>
</blockquote>
<p dir="auto">That particular credit does quite explicitly tell you it’s Python 2.  I am not sure how there could be any confusion about that point.  What I was correcting is the implication that the PythonScript <em>plugin</em> using Python 2 somehow means that the <em>plugin</em> is old.  It’s not.  PythonScript 2.0.0 using Python 2.7.18 is the most recent non-beta release of the <em>plugin</em>.</p>
<blockquote>
<blockquote>
<p dir="auto">But that doesn’t stop you from installing it manually.</p>
</blockquote>
<p dir="auto">I’m sure all the script kiddies that come here looking for you to write their regexps for them won’t bother to do that when you say “that’s too complex for a regexp - try this instead”.  I’d rather design for the tools that others are most likely to actually <strong>have</strong>.</p>
</blockquote>
<p dir="auto">I understand that sentiment.  I do hope that PythonScript 3 which uses Python 3 moves out of beta soon. The only reason I haven’t updated to it is for the reason you stated – it’s harder to convince a random user to install the beta version of the plugin, so when I develop a script here, I want to do it for the plugin that’s easiest for them to install.  As <a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: michael-vincent">@<bdi>michael-vincent</bdi></a> said, the “beta” version has been pretty stable for quite a while now, so I don’t know what milestone it wants to hit before transitioning out of beta.</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/84357">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">It’s probably because instead of asking a pointed question, you just dump out a lot of code like you did above.</p>
</blockquote>
<p dir="auto">Okay, since you couldn’t find the pointed question, here it is:  How do I get an exception raised in the context of Tkinter to be passed up to the calling routine the way it would be if Tkinter wasn’t involved?  (My test code included samples of both situations, because I felt it was necessary to show both - but admittedly, that did make the code longer.  Also, I now know not to expect an answer to this here, so I’ll keep looking elsewhere.)</p>
</blockquote>
<p dir="auto">I know nothing about Tkinter, so I cannot help you with those specifics.  However, my first web search for “python 2.7 tkinter exception not being caught by my script” brought me to <a href="https://stackoverflow.com/questions/6666882/tkinter-python-catching-exceptions" rel="nofollow ugc">this</a> as the first hit, and it seems to be describing the exact circumstance you are having. You might want to study those answers.</p>
<p dir="auto">Further, though you are tired of hearing it, “how do I get an exception in Tkinter to pass all the way to my calling program in Python 2.7?” is a Notepad++-agnostic question, and off-topic here, even if the Pythonistas refuse to help you with it at other sites.  If that’s the way they treat fellow python users, I’m glad Python isn’t my language-of-choice-or-requirement for the bulk of my programming life.</p>
<blockquote>
<blockquote>
<p dir="auto">Gosh, even I didn’t want to look at that Tkinter junk–ugh.  Sorry, I just don’t personally feel that Tkinter is good enough for, well, any use whatsoever.</p>
</blockquote>
<p dir="auto">And I don’t think abusing the text box capabilities of Python as a means to present options to the user is good enough for, well, any use whatsoever - so I guess we’re even there.</p>
</blockquote>
<p dir="auto">Notepad++ with the PythonScript Plugin was not intended as a super-fancy GUI-based-solution.  PythonScript was meant to simply automate tasks.  But presuming Tkinter is a standard GUI suite for Python which has been around since before Python 2.7, it should be able to properly throw an exception</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84364</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84364</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 23 Feb 2023 14:07:18 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Thu, 23 Feb 2023 09:54:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/84355">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">[TBR] Yeah, but every time I try asking somewhere else they say “Old Python versions are off topic here”.</p>
</blockquote>
<blockquote>
<p dir="auto">The overflowing stack of code writers don’t have such a restriction that I know of.</p>
</blockquote>
<p dir="auto">I guess I’m not looking for this knowledge in the right places, then.</p>
<blockquote>
<p dir="auto">You complained to us about an old version of PythonScript in Plugins Admin, but the screenshot highlights that you’re actually wondering about the old version of the Python interpreter that’s part of PythonScript Plugin.</p>
</blockquote>
<p dir="auto">Okay, but putting that particular credit front and center made me question whether I’m really using Python 2 or 3 when running my “scripts”.  (I know that I shouldn’t be calling them that, but I’m trying to go with the flow.)</p>
<blockquote>
<p dir="auto">But that doesn’t stop you from installing it manually.</p>
</blockquote>
<p dir="auto">I’m sure all the script kiddies that come here looking for you to write their regexps for them won’t bother to do that when you say “that’s too complex for a regexp - try this instead”.  I’d rather design for the tools that others are most likely to actually <strong>have</strong>.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/84357">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">It’s probably because instead of asking a pointed question, you just dump out a lot of code like you did above.</p>
</blockquote>
<p dir="auto">Okay, since you couldn’t find the pointed question, here it is:  How do I get an exception raised in the context of Tkinter to be passed up to the calling routine the way it would be if Tkinter wasn’t involved?  (My test code included samples of both situations, because I felt it was necessary to show both - but admittedly, that did make the code longer.  Also, I now know not to expect an answer to this here, so I’ll keep looking elsewhere.)</p>
<blockquote>
<p dir="auto">Gosh, even I didn’t want to look at that Tkinter junk–ugh.  Sorry, I just don’t personally feel that Tkinter is good enough for, well, any use whatsoever.</p>
</blockquote>
<p dir="auto">And I don’t think abusing the text box capabilities of Python as a means to present options to the user is good enough for, well, any use whatsoever - so I guess we’re even there.</p>
<p dir="auto">When designing a program, I always start with the UI, and let that dictate the internal design decisions - because a useful program with an ugly or confusing UI simply won’t get used.  The users that I used to design for would’ve rather had programs with rough edges - as long as they were hidden behind a pretty interface.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84361</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84361</guid><dc:creator><![CDATA[TBugReporter]]></dc:creator><pubDate>Thu, 23 Feb 2023 09:54:38 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Thu, 23 Feb 2023 01:49:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/84355">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">But that doesn’t stop you from installing it manually.</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tbugreporter" aria-label="Profile: TBugReporter">@<bdi>TBugReporter</bdi></a><br />
I’ve been running the beta 3.x versions with manual install each time a new beta is released since I started with PythonScript pre-2020 and have had no issues.</p>
<p dir="auto">Caveat I use UTF-8 for all my files (made this my default Notepad++ setting) and use just US-English character codes.</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84358</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84358</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Thu, 23 Feb 2023 01:49:37 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Thu, 23 Feb 2023 01:54:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tbugreporter" aria-label="Profile: TBugReporter">@<bdi>TBugReporter</bdi></a></p>
<blockquote>
<p dir="auto">every time I try asking somewhere else they say “Old Python versions are off topic here”.</p>
</blockquote>
<p dir="auto">It’s probably because instead of asking a pointed question, you just dump out a lot of code like you did above.  Probably nobody wants to debug your code for you, so they come up with an excuse.  Gosh, even I didn’t want to look at that Tkinter junk–ugh.  Sorry, I just don’t personally feel that Tkinter is good enough for, well, any use whatsoever.</p>
<p dir="auto">Exception handling in Python isn’t really specific to “older” Pythons.  It seems that if you’re asking a general question about it in another forum, no one is going to say to you something about the age of your Python.  But…you have to ask a reasonable question, and maybe you’re not to that stage yet.</p>
<blockquote>
<p dir="auto">why is the “Plugins Admin” version of PythonScript so old?</p>
</blockquote>
<p dir="auto">PythonScript 2.0 is NOT “old”.  It may use a Python interpreter that is deemed “old”, but it does so for a reasonable reason.  Python 2 and Python 3 differ in one huge way: How they treat strings.  Python 2 doesn’t support unicode very well.  Python 3 does.  Because Notepad++ supports non-unicode encodings and always has, Python 2 is a great choice via PythonScript 2.0.  If one isn’t going to use non-unicode encodings, then PythonScript 3.0 is probably the better choice.  If the PythonScript developers figure out how to handle non-unicode encodings well in a Python 3 environment (that doesn’t like them), then PythonScript 2 could be phased out in favor of PythonScript 3.</p>
<blockquote>
<p dir="auto">I imagine it makes it more difficult to assist users when they’re likely not using the same version that you are.</p>
</blockquote>
<p dir="auto">Occasionally this is true.  The “recommended” version is PS 2.0 and that’s what I use, but sometimes the scripts I share have some deficiency relating to unicode.  One that comes to mind is a script that would open a filename in a text file, and that filename happened to include unicode characters.  It was only a slight script adjustment, but I seem to recall the poster that complained about it went kind of nuts.  Ah, well.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84357</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84357</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 23 Feb 2023 01:54:44 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Thu, 23 Feb 2023 01:01:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tbugreporter" aria-label="Profile: TBugReporter">@<bdi>TBugReporter</bdi></a>,.</p>
<blockquote>
<p dir="auto">Yeah, but every time I try asking somewhere else they say “Old Python versions are off topic here”.</p>
</blockquote>
<p dir="auto">The overflowing stack of code writers don’t have such a restriction that I know of.</p>
<blockquote>
<p dir="auto"><img src="/assets/uploads/files/1677112924841-old-python.png" alt="old Python.png" class=" img-fluid img-markdown" /></p>
</blockquote>
<p dir="auto">You complained to us about an old version of PythonScript in Plugins Admin, but the screenshot highlights that you’re actually wondering about the old version of the Python interpreter that’s part of PythonScript Plugin.</p>
<p dir="auto">PythonScript is currently developing a Python 3 version of PythonScript Plugin, which is available for download in the PythonScript repository… But since it’s a huge project, it’s still considered alpha/beta and thus not in Plugins Admin yet.  But that doesn’t stop you from installing it manually.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84355</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84355</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 23 Feb 2023 01:01:12 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Thu, 23 Feb 2023 00:44:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/84351">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">General Python exception handling questions are off-topic for this forum.</p>
</blockquote>
<p dir="auto">Yeah, but every time I try asking somewhere else they say “Old Python versions are off topic here”.<br />
<img src="https://camo.nodebb.org/e4008433324d830ed53c6cd5a0b6d612d323b55c?url=https%3A%2F%2Fwww.myenglishteacher.eu%2Fwp-content%2Fuploads%2F2014%2F06%2Fheadbang.png" alt="Head Bang Emoji" class=" img-fluid img-markdown" /></p>
<blockquote>
<p dir="auto">Maybe you could be more specific in this question, like exactly what you see and why you think it is old?</p>
</blockquote>
<p dir="auto"><img src="/assets/uploads/files/1677112924841-old-python.png" alt="old Python.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/84354</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84354</guid><dc:creator><![CDATA[TBugReporter]]></dc:creator><pubDate>Thu, 23 Feb 2023 00:44:12 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Wed, 22 Feb 2023 13:02:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tbugreporter" aria-label="Profile: TBugReporter">@<bdi>TBugReporter</bdi></a> said in <a href="/post/84339">Using the PythonScript plugin to automate N++</a>:</p>
<hr />
<blockquote>
<p dir="auto">I’m still having trouble with exception handling</p>
</blockquote>
<p dir="auto">General Python exception handling questions are off-topic for this forum.</p>
<hr />
<blockquote>
<p dir="auto">why is the “Plugins Admin” version of PythonScript so old?</p>
</blockquote>
<p dir="auto">If I look at it, it shows the current version.  Maybe you could be more specific in this question, like exactly what you see and why you think it is old?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84351</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84351</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 22 Feb 2023 13:02:44 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Wed, 22 Feb 2023 07:12:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a><br />
I’m sorry, but I’m still having trouble with exception handling; when Tk is involved, it seems to eat the exception itself instead of passing it up to Python.  Some sample code:</p>
<pre><code class="language-python"># -*- coding: utf-8 -*-
from Npp import MESSAGEBOXFLAGS

def main():

    print("Program started")
    tk_ok = False
    try:                                                    # see if we can do pretty dialogs
        import Tkinter as tk
        import qq                                           # DEBUG:  bogus name to force error triggering
        tk_ok = True
        print("Found tk")                                   # DEBUG
    except ImportError as e:                                # if not, tell user
        user_response = notepad.messageBox(
            ("Unable to import Tcl/Tk libraries.\n\n" + e.message), 
            "Missing Library",
            MESSAGEBOXFLAGS.OKCANCEL | MESSAGEBOXFLAGS.ICONWARNING)
        if user_response == MESSAGEBOXFLAGS.RESULTCANCEL:
            print("RESULTCANCEL loading Tkinter")           # DEBUG
            raise KeyboardInterrupt                         # closest exception to this condition
            while True:                                     # DEBUG:  wait for stop to happen
                print("Should have stopped!")
        elif user_response == MESSAGEBOXFLAGS.RESULTOK:
            print("RESULTOK loading Tkinter")               # DEBUG

    if tk_ok:
        my_dlg_bx = tk.Tk()

        def btn_cncl_action():
            print("Program CANCELLED")
            my_dlg_bx.destroy()
            raise KeyboardInterrupt                         # BUG:  doesn't work like above
            while True:                                     # DEBUG:  wait for stop to happen
                print("Should have stopped!")
        btn_cncl     = tk.Button     (
            my_dlg_bx,
            command     = btn_cncl_action,
            text        = "Cancel",
            width       = 10,
                                     )
        btn_cncl.pack    (padx   = 10,
                          pady   = 10,
                          side   = tk.RIGHT
                         )

        my_dlg_bx.attributes("-toolwindow", True)
        my_dlg_bx.attributes("-topmost", True)
        my_dlg_bx.resizable(width = False, height = False)
        my_dlg_bx.title("My Custom Dialog Box")
        my_dlg_bx.mainloop()
    # end "if tk_ok"

    print("Program should NOT get here if user clicks Cancel button")
    # do main program stuff here

    print("Program ended")                                  # DEBUG

main()
</code></pre>
<p dir="auto">This code does as I expect - so long as the exception is in the <strong>testing</strong> for Tk.  Comment out <code>import qq</code>, let Tk create and display “My Custom Dialog Box”, and click on its “Cancel” button, and a similar traceback appears in the console - but preceded by <code>Exception in Tkinter callback</code>. What can I do to get these exceptions both treated the same way?  (And yes, I do realize that this sample code does nothing to actually catch the exception; I wanted to be sure it wasn’t my code that was eating it.)</p>
<hr />
<p dir="auto">And on a (probably) unrelated note, why is the “Plugins Admin” version of PythonScript so old?  There are probably lots of people using it that don’t realize how outdated it is.  Plus, I imagine it makes it more difficult to assist users when they’re likely not using the same version that you are.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84339</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84339</guid><dc:creator><![CDATA[TBugReporter]]></dc:creator><pubDate>Wed, 22 Feb 2023 07:12:42 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Mon, 20 Feb 2023 14:59:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tbugreporter" aria-label="Profile: TBugReporter">@<bdi>TBugReporter</bdi></a> said in <a href="/post/84299">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">Would you mind sharing?</p>
</blockquote>
<p dir="auto">Here’s <code>NppHwnd.py</code>:</p>
<pre><code class="language-py"># -*- coding: utf-8 -*-
from __future__ import print_function

from ctypes import (WinDLL, WINFUNCTYPE, create_unicode_buffer, byref)
from ctypes.wintypes import (BOOL, HWND, LPARAM, DWORD)

def find_npp_hwnd():

    user32 = WinDLL('user32')
    kernel32 = WinDLL('kernel32')

    WNDENUMPROC = WINFUNCTYPE(BOOL, HWND, LPARAM)

    our_pid = kernel32.GetCurrentProcessId()
    dw_process_id = DWORD()

    ubuff_size = 1024
    ubuffer = create_unicode_buffer(ubuff_size)

    notepad.hwnd = 0

    def foreach_window_to_find_npp(hwnd, __):
        if user32.IsWindowVisible(hwnd):  # maybe the check for being visible is not necessary?
            text_length = user32.GetWindowTextLengthW(hwnd)
            if 0 &lt; text_length &lt; ubuff_size:
                user32.GetWindowTextW(hwnd, ubuffer, text_length + 1)
                if u'- Notepad++' in ubuffer.value:
                    user32.GetWindowThreadProcessId(hwnd, byref(dw_process_id))
                    if dw_process_id.value == our_pid:
                        notepad.hwnd = hwnd
                        return False  # stop enumerating
        return True  # continue enumerating

    user32.EnumWindows(WNDENUMPROC(foreach_window_to_find_npp), 0)  # enumerate Desktop windows

    print('notepad.hwnd:', notepad.hwnd)

find_npp_hwnd()
</code></pre>
<p dir="auto">Note that this script, like the original line of <a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> code ( <code>notepad.hwnd = FindWindow(u'Notepad++', None)</code> ), <em>adds</em> the <code>hwnd</code> member to the pre-existing <code>notepad</code> object.</p>
<p dir="auto">Perhaps some explanation is in order:  This script finds desktop windows with <code>- Notepad++</code> in their titlebar.  Since N++ always has this string of characters in its titlebar, it can be located in this manner.  If there happens to be multiple instances of Notepad++ running, multiple windows will be located because they will all have the string in the titlebar – how to tell them apart?  This script compares the process id of the located window to see if it is the same id as that under which the script is running; if so then we know we’ve located the desired N++ window.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84308</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84308</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 20 Feb 2023 14:59:09 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Mon, 20 Feb 2023 08:43:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a></p>
<blockquote>
<p dir="auto">this was only implemented for the console</p>
</blockquote>
<p dir="auto">Seems like you are right. At least the names of the files changed in the commit I mentioned above indicate that. I’ve missed that, sorry.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84306</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84306</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Mon, 20 Feb 2023 08:43:27 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Mon, 20 Feb 2023 08:24:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a></p>
<p dir="auto">As far as I understand, this was only implemented for the console and is probably why the issue is still open.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84304</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84304</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Mon, 20 Feb 2023 08:24:23 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Mon, 20 Feb 2023 07:22:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/84288">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">the primary person maintaining PS seemed to have no clue as to why it would be valuable</p>
</blockquote>
<p dir="auto"><em>PythonScript</em> plugin v3.0.15 should contain that feature. See <a href="https://github.com/bruderstein/PythonScript/compare/v3.0.14...v3.0.15" rel="nofollow ugc">change log 3.0.14 to 3.0.15</a>, commit <a href="https://github.com/bruderstein/PythonScript/commit/2c178d8f4257d9e4bcc00cf834d3e00fee4bdb84" rel="nofollow ugc">2c178d8</a> from 2022-11-21.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84302</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84302</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Mon, 20 Feb 2023 07:22:29 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Mon, 20 Feb 2023 00:18:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/84281">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">I have some more complicated code to find the correct N++</p>
</blockquote>
<p dir="auto">Would you mind sharing?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84299</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84299</guid><dc:creator><![CDATA[TBugReporter]]></dc:creator><pubDate>Mon, 20 Feb 2023 00:18:07 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Sun, 19 Feb 2023 13:37:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> said in <a href="/post/84283">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">would be nice if PS would provide this, I know there is an open issue</p>
</blockquote>
<p dir="auto">Yes, <a href="https://github.com/bruderstein/PythonScript/issues/256" rel="nofollow ugc">HERE</a>, but from the comment <a href="https://github.com/bruderstein/PythonScript/issues/256#issuecomment-1310997681" rel="nofollow ugc">HERE</a> the primary person maintaining PS seemed to have no clue as to why it would be valuable. :-(</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84288</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84288</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 19 Feb 2023 13:37:18 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Sun, 19 Feb 2023 12:13:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a></p>
<p dir="auto">It would be nice if PS would provide this, I know there is an open issue …</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84283</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84283</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sun, 19 Feb 2023 12:13:54 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Sun, 19 Feb 2023 12:12:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> said in <a href="/post/84280">Using the PythonScript plugin to automate N++</a>:</p>
<blockquote>
<p dir="auto">normaly yes - but 100% guaranteed - I assume no.</p>
</blockquote>
<p dir="auto">I asked because I have some more complicated code to find the correct N++, and I was wondering if it was necessary.  I’ll keep it. :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84281</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84281</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 19 Feb 2023 12:12:13 GMT</pubDate></item><item><title><![CDATA[Reply to Using the PythonScript plugin to automate N++ on Sun, 19 Feb 2023 12:10:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a></p>
<p dir="auto">normaly yes - but 100% guaranteed - I assume no.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84280</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84280</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sun, 19 Feb 2023 12:10:57 GMT</pubDate></item></channel></rss>