<?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[MacroInspect which comments macros]]></title><description><![CDATA[<p dir="auto">Created a <a href="https://gist.github.com/mpheath/5de696444747fa4bb7dbcdc92432307d" rel="nofollow ugc">gist</a> of a recent created script that can read <code>shortcut.xml</code> read from a tab or a file. It requires PythonScript 3. Add it to the scripts directory and run it from the Plugins menu.</p>
<p dir="auto">View <a href="https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript">help</a> with PythonScript if needed in the FAQ.</p>
<p dir="auto">The script can download from the Notepad++ repository files named <code>FindReplaceDlg_rc.h</code> and <code>Scintilla.h</code> which are read to create json files. The json files will contain the ID numbers and constant names to be used in the comments of the new opened tab with the <code>shortcut.xml</code> content.</p>
<p dir="auto">The local <code>nativeLang.xml</code> file will be read to create a dictionary with ID numbers and names. So hopefully non-english users may see these comments in their native language.</p>
<p dir="auto">With these dictionaries, an example of just macro’s:</p>
<pre><code>        &lt;Macro name="Trim Trailing Space and Save" Ctrl="no" Alt="yes" Shift="yes" Key="83"&gt;
            &lt;Action type="2" message="0" wParam="42024" lParam="0" sParam="" /&gt;
            &lt;Action type="2" message="0" wParam="41006" lParam="0" sParam="" /&gt;
        &lt;/Macro&gt;
</code></pre>
<p dir="auto">is displayed as:</p>
<pre><code>        &lt;Macro name="Trim Trailing Space and Save" Ctrl="no" Alt="yes" Shift="yes" Key="83"&gt;
            &lt;!-- Trim Trailing Space --&gt;
            &lt;Action type="2" message="0" wParam="42024" lParam="0" sParam="" /&gt;
            &lt;!-- &amp;amp;Save --&gt;
            &lt;Action type="2" message="0" wParam="41006" lParam="0" sParam="" /&gt;
        &lt;/Macro&gt;
</code></pre>
<p dir="auto">Another example that <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> posted recently with comments added by the script:</p>
<pre><code>        &lt;Macro name="DelUnderBookmarks" Ctrl="yes" Alt="no" Shift="yes" Key="121"&gt;
            &lt;!-- Next Bookmark --&gt;
            &lt;Action type="2" message="0" wParam="43006" lParam="0" sParam="Next Bookmark" /&gt;
            &lt;!-- Toggle Bookmark --&gt;
            &lt;Action type="2" message="0" wParam="43005" lParam="0" sParam="Toggle Bookmark" /&gt;
            &lt;!-- SCI_LINEDOWN --&gt;
            &lt;Action type="0" message="2300" wParam="0" lParam="0" sParam="Line Down" /&gt;
            &lt;!-- SCI_LINEDELETE --&gt;
            &lt;Action type="0" message="2338" wParam="0" lParam="0" sParam="Line Delete" /&gt;
        &lt;/Macro&gt;
</code></pre>
<p dir="auto">So the ID numbers … are used to create XML comments so the macros are more understandable to read.</p>
<p dir="auto">Some other various comments seen though testing:</p>
<pre><code>&lt;!-- Clear All Bookmarks --&gt;
&lt;!-- Remove Bookmarked Lines --&gt;
&lt;!-- IDC_FRCOMMAND_INIT --&gt;
&lt;!-- IDFINDWHAT --&gt;
&lt;!-- IDNORMAL [Normal] --&gt;
&lt;!-- IDNORMAL [Extended] --&gt;
&lt;!-- IDNORMAL [RegEx] --&gt;
&lt;!-- IDC_FRCOMMAND_BOOLEANS --&gt;
&lt;!-- IDC_FRCOMMAND_EXEC --&gt;
&lt;!-- SCI_REPLACESEL --&gt;
&lt;!-- SCI_TAB --&gt;
</code></pre>
<p dir="auto">I have tested with portable Notepad++ so if have problems with installed Notepad++ then let me know and I will look into it. The script is quite new so perhaps some bugs exist.</p>
<p dir="auto">Let me know how the experience is with testing the script. The files are downloaded to the plugins <code>Config</code> directory and that is where the json files will be created so that you know where they are if an inspection or cleanup is wanted.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/26522/macroinspect-which-comments-macros</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Jul 2026 18:06:34 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/26522.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 03 Jan 2025 10:01:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MacroInspect which comments macros on Sun, 12 Jan 2025 23:18:42 GMT]]></title><description><![CDATA[<p dir="auto">To All, I have updated the <a href="https://gist.github.com/mpheath/5de696444747fa4bb7dbcdc92432307d" rel="nofollow ugc">gist</a> with revision 8.</p>
<ul>
<li>Replace constant <code>IDF_WHICH_DIRECTION</code> with alternative <code>IDF_FORWARD_DIRECTION</code> to make it more meaningful with the action.</li>
<li>Use <code>html.unescape()</code> on type2 values to resolve entities. Example <code>&amp;amp;</code> will change to <code>&amp;</code>.</li>
</ul>
<hr />
<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> OK, XML comments do not require escapes with entities. <code>--</code> can be a problem with XML comments so will be reduced to single <code>-</code> if exist.</p>
<p dir="auto">Replacing <code>IDF_WHICH_DIRECTION</code> is OK so as to avoid user confusion with which direction. The json will inherit the change so the file needs to be removed to get the alternative value of <code>IDF_FORWARD_DIRECTION</code>. Or, just edit the values in the json file to your liking.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99095</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99095</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Sun, 12 Jan 2025 23:18:42 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sat, 11 Jan 2025 11:23:31 GMT]]></title><description><![CDATA[<p dir="auto">Such a minor quibble it isn’t worth mentioning, but if you end up doing any more changes maybe throw in a change that would remove all <code>&amp;amp;</code> strings from the comment?, e.g.:</p>
<pre><code>            &lt;!-- &amp;amp;Save --&gt;
            &lt;Action type="2" message="0" wParam="41006" lParam="0" sParam="" /&gt;
</code></pre>
<hr />
<p dir="auto">And, I know it messes with the “purity” of the algorithm, but consider changing:</p>
<pre><code>            &lt;!-- IDC_FRCOMMAND_BOOLEANS  [IDF_WHICH_DIRECTION] --&gt;
            &lt;Action type="3" message="1702" wParam="0" lParam="512" sParam="" /&gt;
</code></pre>
<p dir="auto">to something like:</p>
<pre><code>            &lt;!-- IDC_FRCOMMAND_BOOLEANS  [forward_direction] --&gt;
            &lt;Action type="3" message="1702" wParam="0" lParam="512" sParam="" /&gt;
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/99080</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99080</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 11 Jan 2025 11:23:31 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sat, 11 Jan 2025 06:04:01 GMT]]></title><description><![CDATA[<p dir="auto">To All, I have updated the <a href="https://gist.github.com/mpheath/5de696444747fa4bb7dbcdc92432307d" rel="nofollow ugc">gist</a> with revision 7.</p>
<ul>
<li>Added dictionary provided by <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> to improve <code>IDC_FRCOMMAND_BOOLEANS</code> processing with valid boolean lists.</li>
</ul>
<p dir="auto">Let me know of issues.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99079</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99079</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Sat, 11 Jan 2025 06:04:01 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sat, 11 Jan 2025 01:33:52 GMT]]></title><description><![CDATA[<pre><code class="language-py">        'numeric_value_to_relevant_options' : {
        #          ww  mc  pp  bm   sub  hid  sel   wrp   bwd   dot
            1    : 1 | 2 |                          256 | 512 | 1024,             # find_next
            1608 : 1 | 2 |                          256 | 512 | 1024,             # replace
            1609 : 1 | 2 |                    128 | 256 | 512 | 1024,             # replace_all
            1614 : 1 | 2 |                    128 | 256 | 512 | 1024,             # count
            1615 : 1 | 2 | 4 | 16 |           128 | 256 | 512 | 1024,             # mark
            1633 :             16 |           128 | 256 | 512       ,             # clear_marking
            1635 : 1 | 2 |                                      1024,             # replace_in_open_tabs
            1636 : 1 | 2 |                                      1024,             # find_in_open_tabs
            1641 : 1 | 2 |                                      1024,             # find_in_active_tab
            1656 : 1 | 2 |          32 | 64 |                   1024,             # find_in_files
            1660 : 1 | 2 |          32 | 64 |                   1024,             # replace_in_files
        #                                     prj1  prj2  prj3
            1665 : 1 | 2 |                    128 | 256 | 512 | 1024,             # replace_in_projects
            1666 : 1 | 2 |                    128 | 256 | 512 | 1024,             # find_in_projects
        },
</code></pre>
<p dir="auto">I’d use the 1701 msg’s numeric data as the key to looking into this dict to get a <code>relevant_options_val</code>.  Then I’d take the previous 1702 msg’s numeric data and AND it with <code>~relevant_options_val</code> to calculate <code>unneeded_options</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99078</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99078</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 11 Jan 2025 01:33:52 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Fri, 10 Jan 2025 22:41:18 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> This table is a whitelist or a blacklist? If a whitelist then perhaps could replace the <code>range()</code> with predefined flags in a list like is in your table. Could you paste the table as text in a codebox so it can be copied as text? Then will try 2 pass reading to get the <code>16**</code> numbers to know which list of booleans to bitwise and append to the comment. Just need to test this concept and it may work more to users satisfaction.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99076</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99076</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Fri, 10 Jan 2025 22:41:18 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Fri, 10 Jan 2025 19:06:32 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:</p>
<blockquote>
<p dir="auto">I will follow-up and put an issue in on this.</p>
</blockquote>
<p dir="auto">Issue is <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/issues/16044" rel="nofollow ugc">CREATED</a>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99075</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99075</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 10 Jan 2025 19:06:32 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Fri, 10 Jan 2025 14:42:03 GMT]]></title><description><![CDATA[<p dir="auto">To All, I have updated the <a href="https://gist.github.com/mpheath/5de696444747fa4bb7dbcdc92432307d" rel="nofollow ugc">gist</a> with revision 6.</p>
<p dir="auto">Revision 5:</p>
<ul>
<li>Fixed root path for portable and installed.</li>
</ul>
<p dir="auto">Revision 6:</p>
<ul>
<li>Fixed EOL to be CRLF.</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/99072</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99072</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Fri, 10 Jan 2025 14:42:03 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Fri, 10 Jan 2025 13:24:50 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">Maybe a N++ issue should be raised that sometimes irrelevant search options are being recorded into the booleans? What do you think?</p>
</blockquote>
<blockquote>
<p dir="auto">I consider good to fix the problem at the source. Ideally, the script should just do as is done already without doing excessive filtering. It tires me just to think of having to do more when it should not be needed if the booleans were concise and correct … or perhaps I am not so young anymore.</p>
</blockquote>
<p dir="auto">I will follow-up and put an issue in on this.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99070</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99070</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 10 Jan 2025 13:24:50 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Fri, 10 Jan 2025 13:18:33 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/99068">MacroInspect which comments macros</a>:</p>
<blockquote>
<p dir="auto">Assuming you mean “Python normalizes \n to \r\n on Windows”, yes, this is true but only when writing to a file, which your code is not doing (you are writing to an untitled tab, e.g. <code>new 2</code>).</p>
</blockquote>
<p dir="auto">Reading and write to files, Python does normalize though the <code>editor</code> methods do not so may need to harmonize EOLs which I may have solved locally and can post a revised update. <code>shortcuts.xml</code> can be read from editor and read from file so both need to be <code>\r\n</code> literally so <code>editor.addText()</code> adds <code>\r\n</code> literally.</p>
<blockquote>
<p dir="auto">… and I saw <code>PROJECT3</code> in it, and that is irrelevant to a <code>FINDINFILES</code>.  But really, I think it is just a boolean (for “direction”) that doesn’t affect the search but got in there as part of the “loose” N++ code handling the booleans when a macro is recorded.  Maybe it is another good reason to filter it out or flag it somehow – so dumb users like me don’t think it is relevant.  Again, not sure how much further you want to take your script.</p>
</blockquote>
<p dir="auto">Ah, the extra constants that perhaps should not be there in the comments as I mentioned earlier. How far? not more than what is needed is what I hope for.</p>
<blockquote>
<p dir="auto">Maybe helpful as a reference, here’s what I had in my old “disassembler” code as to what options are relevant to what search actions:</p>
</blockquote>
<p dir="auto">An interesting table, this might be useful for filtering with a blacklist. Certainly a great effort into making the table. Well done.</p>
<blockquote>
<p dir="auto">Maybe a N++ issue should be raised that sometimes irrelevant search options are being recorded into the booleans?  What do you think?</p>
</blockquote>
<p dir="auto">I consider good to fix the problem at the source. Ideally, the script should just do as is done already without doing excessive filtering. It tires me just to think of having to do more when it should not be needed if the booleans were concise and correct … or perhaps I am not so young anymore.</p>
<p dir="auto">Will see what can be done with the script within reason. I like doing things based on interest though sometimes it can feel like torture and the filtering implementation reminds me of the latter.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99069</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99069</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Fri, 10 Jan 2025 13:18:33 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Fri, 10 Jan 2025 11:50:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mpheath" aria-label="Profile: mpheath">@<bdi>mpheath</bdi></a> said:</p>
<blockquote>
<p dir="auto">Python normalizes \n to the newline sequence</p>
</blockquote>
<p dir="auto">Assuming you mean “Python normalizes \n to \r\n on Windows”, yes, this is true but only when writing to a file, which your code is not doing (you are writing to an untitled tab, e.g. <code>new 2</code>).</p>
<hr />
<blockquote>
<p dir="auto">Perhaps you have a macro that shows where this selection fails?</p>
</blockquote>
<p dir="auto">OK.<br />
I saw this:</p>
<pre><code>            &lt;!-- IDC_FRCOMMAND_BOOLEANS  [IDF_MATCHCASE, IDF_FINDINFILES_RECURSIVE_CHECK, IDF_FINDINFILES_PROJECT3_CHECK] --&gt;
            &lt;Action type="3" message="1702" wParam="0" lParam="546" sParam="" /&gt;
            &lt;!-- IDC_FRCOMMAND_EXEC  [IDD_FINDINFILES_FIND_BUTTON] --&gt;
            &lt;Action type="3" message="1701" wParam="0" lParam="1656" sParam="" /&gt;
</code></pre>
<p dir="auto">and I saw <code>PROJECT3</code> in it, and that is irrelevant to a <code>FINDINFILES</code>.  But really, I think it is just a boolean (for “direction”) that doesn’t affect the search but got in there as part of the “loose” N++ code handling the booleans when a macro is recorded.  Maybe it is another good reason to filter it out or flag it somehow – so dumb users like me don’t think it is relevant.  Again, not sure how much further you want to take your script.</p>
<p dir="auto">Maybe helpful as a reference, here’s what I had in my old “disassembler” code as to what options are relevant to what search actions:<br />
<img src="/assets/uploads/files/1736509508190-27658e44-9c7f-4dfb-ba0e-d6dac0a9d04a-image.png" alt="27658e44-9c7f-4dfb-ba0e-d6dac0a9d04a-image.png" class=" img-fluid img-markdown" /><br />
I think you can figure out that “ww” is whole-word and “mc” is match-case.  “pp” had me confused for a moment, but I think it is presearch-purge.</p>
<hr />
<p dir="auto">Maybe a N++ issue should be raised that sometimes irrelevant search options are being recorded into the booleans?  What do you think?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99068</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99068</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 10 Jan 2025 11:50:36 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Fri, 10 Jan 2025 11:27:01 GMT]]></title><description><![CDATA[<p dir="auto">OK, bug squashing time. Just committed revision 5 though let’s works towards revision 6.</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/99066">MacroInspect which comments macros</a>:</p>
<blockquote>
<p dir="auto">One minor thing I noticed that I thought a bit odd was that the output file tab had LF line endings rather than the more traditional CRLF, but this is hardly important.</p>
</blockquote>
<p dir="auto">Python normalizes <code>\n</code> to the newline sequence though may need to set the new tab to use CRLF.</p>
<blockquote>
<p dir="auto">A “second pass” might be worth it for the “booleans”, because you could (a) be more specific about them (e.g. is it “in selection” or is it “project 1”?), and (b) you could filter out or flag irrelevant options (e.g. “search direction” is meaningless for a file-level search operation, but it can be encoded in the booleans).</p>
</blockquote>
<p dir="auto">a) There is no <code>1or2</code> AFAIK. This is the purpose of <code>find_in_files_mode</code> which is the boolean flag to select which one of the pairs of constants to display. It determines this based on a previous action containing <code>FINDINFILES</code>. Perhaps you have a macro that shows where this selection fails?</p>
<p dir="auto">b) It is a odd constant I agree. <code>IDF_WHICH_DIRECTION</code> is forward direction though not displayed if backwards if I have that correct. Seems poorly named and knowing if backwards seems more important.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99067</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99067</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Fri, 10 Jan 2025 11:27:01 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Fri, 10 Jan 2025 11:01:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mpheath" aria-label="Profile: mpheath">@<bdi>mpheath</bdi></a></p>
<p dir="auto">Getting better all the time…</p>
<p dir="auto">One minor thing I noticed that I thought a bit odd was that the output file tab had LF line endings rather than the more traditional CRLF, but this is hardly important.</p>
<p dir="auto">A “second pass” might be worth it for the “booleans”, because you could (a) be more specific about them (e.g. is it “in selection” or is it “project 1”?), and (b) you could filter out or flag irrelevant options (e.g. “search direction” is meaningless for a file-level search operation, but it can be encoded in the booleans).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99066</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99066</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 10 Jan 2025 11:01:00 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Fri, 10 Jan 2025 00:09:34 GMT]]></title><description><![CDATA[<p dir="auto">To All, I have updated the <a href="https://gist.github.com/mpheath/5de696444747fa4bb7dbcdc92432307d" rel="nofollow ugc">gist</a> with revision 4.</p>
<ul>
<li>Added feature for <code>IDC_FRCOMMAND_BOOLEANS</code> comment to display the options as the related boolean constants.</li>
<li>Added code to only comment Actions that a not in a multi-line comment block which is quite basic code just intended for the existing comments distributed in <code>shortcuts.xml</code>.</li>
</ul>
<p dir="auto">This script might be complete unless I have missed something.</p>
<hr />
<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> Thanks for sharing the <code>IDC_FRCOMMAND_BOOLEANS</code> code that you use. I went with what I had and decided to keep the code basic and not go deeper into it as the <code>IDC_FRCOMMAND_EXEC</code> actions are many. Two passes of the <code>shortcuts.xml</code> could be done to get the <code>IDC_FRCOMMAND_EXEC</code> actions on the first pass and use a blacklist on the second pass though is it better to try simple IMO before trying complex and probably end up with much uglier code. And as you mention earlier with the idea of a PythonScript example script which IMO should be simple to understand.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> I’m not a fan of using attributes as comments though this script may help to get the information quicker which from my point of view was the main goal.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> Thanks for the lesson of why attributes as comments are used. I was not aware of the exact reason before this topic started.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99063</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99063</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Fri, 10 Jan 2025 00:09:34 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sun, 05 Jan 2025 22:43:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mpheath" aria-label="Profile: mpheath">@<bdi>mpheath</bdi></a> said in <a href="/post/98992">MacroInspect which comments macros</a>:</p>
<blockquote>
<p dir="auto">I have already tested IDC_FRCOMMAND_BOOLEANS and ran into issues.</p>
</blockquote>
<p dir="auto">I don’t know…but I’m fairly certain the code I posted works correctly.</p>
<blockquote>
<p dir="auto">which are pairs that share the same boolean value in which only 1 can be correct.</p>
</blockquote>
<p dir="auto">Yep, the “genius” that implemented the project options decided repurposing some bit weighting for that was a great idea.</p>
<blockquote>
<p dir="auto">I suspect that perhaps some bit flags should not be in the lParams value and perhaps the playback ignores them</p>
</blockquote>
<p dir="auto">Yes, there can be items that are not applicable in there.<br />
If one knew in advance what the 1701 value was going to be, one could filter out the n/a items, but alas the 1702 message comes before the 1701.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98994</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98994</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 05 Jan 2025 22:43:36 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sun, 05 Jan 2025 22:17:33 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">I have already tested <code>IDC_FRCOMMAND_BOOLEANS</code> and ran into issues. If you look at the json data file, you may see lines like:</p>
<pre><code>        "128": "IDF_IN_SELECTION_CHECK IDF_FINDINFILES_PROJECT1_CHECK",
        "256": "IDF_WRAP IDF_FINDINFILES_PROJECT2_CHECK",
        "512": "IDF_WHICH_DIRECTION IDF_FINDINFILES_PROJECT3_CHECK",
</code></pre>
<p dir="auto">which has space delimited pairs of constant names.</p>
<p dir="auto">as I use this code to fill the dictionary with the constant pairs:</p>
<pre><code>                if k in dic:
                    dic[k] += ' ' + v
                else:
                    dic[k] = v
</code></pre>
<p dir="auto">which are pairs that share the same boolean value in which only 1 can be correct. Though in testing depending on the FindReplaceDLG tab recorded, sometimes none are correct IMO. I am unsure if I can fix the code I have to make it reliable as some incorrect comments may make the user puzzled. I suspect that perhaps some bit flags should not be in the <code>lParams</code> value and perhaps the playback ignores them, though that does not help with making the xml comments.</p>
<hr />
<p dir="auto">Edit:</p>
<p dir="auto">There is also a possibility that Notepad++ is getting the checkbox booleans incorrect. Unchecked/checked is ok until disabling the checkbox, which leads to a 3rd state with a enabled/disabled needing to be validated. IDK yet and so may need investigation. This may explain why I get <code>IDF_FINDINFILES_PROJECT2_CHECK</code> and <code>IDF_FINDINFILES_PROJECT3_CHECK</code> in the comments even though they are unchecked and disabled so cannot be valid in the xml comments.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98992</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98992</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Sun, 05 Jan 2025 22:17:33 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sun, 05 Jan 2025 21:24:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mpheath" aria-label="Profile: mpheath">@<bdi>mpheath</bdi></a></p>
<p dir="auto">I see you didn’t break down the search “boolean” values in your latest script, so, I took the liberty of pulling that code from my now defunct macro disassembler and inserting it into your script:</p>
<pre><code class="language-py">elif message == 'IDC_FRCOMMAND_BOOLEANS':
    numeric_data = int(v)
    bit_weights_numeric_value_to_str_dict = {
        1    : 'MATCH_WHOLE_WORD_ONLY',
        2    : 'MATCH_CASE',
        4    : 'PURGE_MARKS_BEFORE_NEW_SEARCH',
        16   : 'BOOKMARK_LINE',
        32   : 'IN_SUBFOLDERS',
        64   : 'IN_HIDDEN_FOLDERS',
        128  : 'IN_SELECTION__OR__PROJECT1',
        256  : 'WRAP_AROUND__OR__PROJECT2',
        512  : 'FORWARD_DIRECTION__OR__PROJECT3',
        1024 : 'DOT_MATCHES_NEWLINE_FOR_REGEX',
        }
    running_single_bitweight = 1
    search_options_str_list = []
    while numeric_data != 0:
        if running_single_bitweight in bit_weights_numeric_value_to_str_dict:
            if (numeric_data &amp; running_single_bitweight) != 0:
                search_options_str_list.append(bit_weights_numeric_value_to_str_dict[running_single_bitweight])
        numeric_data &amp;= ~running_single_bitweight
        running_single_bitweight &lt;&lt;= 1
    value_str = 'NONE' if len(search_options_str_list) == 0 else ' / '.join(search_options_str_list)
    comment += '  [ ' + value_str + ' ]'
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/98991</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98991</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 05 Jan 2025 21:24:51 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sun, 05 Jan 2025 18:36:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mpheath" aria-label="Profile: mpheath">@<bdi>mpheath</bdi></a> said:</p>
<blockquote>
<p dir="auto">perhaps your <a href="http://RunCurrentPyFileAsPythonscript.py" rel="nofollow ugc">RunCurrentPyFileAsPythonscript.py</a> can set <strong>file</strong> to the absolute path of the child script before it runs …</p>
</blockquote>
<p dir="auto">A good idea, however it doesn’t work (I still get the calling script’s name/path), at least the way I’m having a script run a script; there are many ways to do it.  It’s actually surprisingly difficult to have a script run a script (and have things all turn out like you’d like).</p>
<hr />
<p dir="auto">LATER EDIT:<br />
Actually, it did work; what caused it to <em>not</em> work the first time I tried it was programmer error, i.e., me!<br />
I may have to look further into using the <code>__file__</code> variable technique instead of my <code>inspect</code>-based technique, as it seems like it could simplify things under Python3.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98985</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98985</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 05 Jan 2025 18:36:48 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sun, 05 Jan 2025 14:11:01 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">Just tested in a Python interpreter. <code>__file__</code> can be set to a value. So perhaps your <code>RunCurrentPyFileAsPythonscript.py</code> can set <code>__file__</code> to the absolute path of the child script before it runs the subprocess, so then the child process use of <code>__file__</code> is inherited like as if it is the main process.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98983</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98983</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Sun, 05 Jan 2025 14:11:01 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sun, 05 Jan 2025 13:52:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mpheath" aria-label="Profile: mpheath">@<bdi>mpheath</bdi></a></p>
<p dir="auto">In general, a way I’ve found to do it is:</p>
<p dir="auto"><code>inspect.getframeinfo(inspect.currentframe()).filename</code></p>
<p dir="auto">after importing <code>inspect</code>, and then getting the directory part of the path from that.</p>
<p dir="auto">This worked great in PythonScript2, as the path to the file was returned from the inspect call.  In PythonScript3, however, all that call obtains is a filename without the complete path.</p>
<p dir="auto">You can experiment with that if you like, or I’ll post some more complete code later.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98982</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98982</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 05 Jan 2025 13:52:21 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sun, 05 Jan 2025 13:29: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></p>
<p dir="auto">Sorry to hear. It’s still a bug even if it is a script running a script.  I just tested <code>sys.argv</code> and thought argument 0 might be OK though it returns <code>['C:\\Programs\\Notepad++\\notepad++.exe']</code>. If you can test something that works for you and everyone else then please share. I may test some alternatives though I am not sure if I can reproduce your environment to be sure of a fix.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98981</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98981</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Sun, 05 Jan 2025 13:29:07 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sun, 05 Jan 2025 12:16:07 GMT]]></title><description><![CDATA[<p dir="auto">I ran revision 3 and it seemed to go as desired.</p>
<p dir="auto">Afterward I looked for the <code>MacroInspect_data.json</code> file and curiously I did not find it anywhere on my system.</p>
<p dir="auto">After changing the code to add <code>print('json_file:', json_file)</code> I then saw the problem.<br />
I use a script to “run the script in the active tab” so that I can tie it to a keycombo for quickly executing a script under development, over and over again as development proceeds.  I think I would go mad if I had to navigate the menus to repeatedly run a script I’m actively working on.  (Yes, there are other alternatives…)</p>
<p dir="auto">Anyway, I found that the data file for your script was being created for me as <code>RunCurrentPyFileAsPythonscript_data.json</code> because my “script runner” script is named <code>RunCurrentPyFileAsPythonscript.py</code>.  This results (apparently) from the use of <code>__file__</code> in your code.</p>
<p dir="auto">No big deal, I can compensate for this…  :-)</p>
<p dir="auto">Again, great job on a great script.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98979</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98979</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 05 Jan 2025 12:16:07 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sun, 05 Jan 2025 06:30:28 GMT]]></title><description><![CDATA[<p dir="auto">To All, I have updated the <a href="https://gist.github.com/mpheath/5de696444747fa4bb7dbcdc92432307d" rel="nofollow ugc">gist</a> with revision 3.</p>
<p dir="auto">Implemented the <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> idea of single json file saved next to the script.</p>
<p dir="auto">Please manually remove existing data files from the Config directory:</p>
<pre><code>FindReplaceDlg_rc.h
FindReplaceDlg_rc.h.json
Scintilla.h
Scintilla.h.json
</code></pre>
<p dir="auto">Update <code>MacroInspect.py</code>  in the <code>Config\PythonScript\scripts</code> directory. On first run should download the header data and save to <code>Config\PythonScript\scripts\MacroInspect_data.json</code>. No temporary header files as the data will all be processed in memory.</p>
<p dir="auto">Improved message <code>1701</code> comment which is  <code>IDC_FRCOMMAND_EXEC</code> will now show it’s <code>lParam</code> related constant.<br />
Some examples:</p>
<pre><code>&lt;!-- IDC_FRCOMMAND_EXEC  [IDCMARKALL] --&gt;
&lt;!-- IDC_FRCOMMAND_EXEC  [IDD_FINDINFILES_FIND_BUTTON] --&gt;
&lt;!-- IDC_FRCOMMAND_EXEC  [IDD_FINDINFILES_FINDINPROJECTS] --&gt;
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/98978</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98978</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Sun, 05 Jan 2025 06:30:28 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sat, 04 Jan 2025 11:24:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mpheath" aria-label="Profile: mpheath">@<bdi>mpheath</bdi></a></p>
<p dir="auto">When I write a script that needs a permanent data file, I put the data file in the same folder as the script with a common prefix on the name.  An example probably helps:</p>
<p dir="auto">Script: <code>...\plugins\Config\PythonScript\scripts\fubar.py</code><br />
Data: <code>...\plugins\Config\PythonScript\scripts\fubar_data.json</code></p>
<p dir="auto">It’s not <em>too</em> messy; locate the script (e.g. Windows Explorer) and the data file is visually adjacent to it.</p>
<hr />
<p dir="auto">If I need more than one data file (i.e., your situation), I give everything its own folder:</p>
<p dir="auto">Folder: <code>...\plugins\Config\PythonScript\scripts\foo\</code><br />
Script: <code>...\plugins\Config\PythonScript\scripts\foo\foo.py</code><br />
Data1: <code>...\plugins\Config\PythonScript\scripts\foo\foo_data1.json</code><br />
Data2: <code>...\plugins\Config\PythonScript\scripts\foo\foo_data2.txt</code></p>
<p dir="auto">In this case it isn’t terribly important to name the data files with the common prefix…</p>
<hr />
<p dir="auto">YMMV.  I’m sure you’ll decide on a workable solution.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98964</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98964</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 04 Jan 2025 11:24:15 GMT</pubDate></item><item><title><![CDATA[Reply to MacroInspect which comments macros on Sat, 04 Jan 2025 02:37:10 GMT]]></title><description><![CDATA[<p dir="auto">To All, I have updated the gist with revision 2.<br />
Minor changes. The header files will be removed if json files are created or already exist.</p>
<hr />
<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/98954">MacroInspect which comments macros</a>:</p>
<blockquote>
<p dir="auto">I’d have been more apt to leave them if the code had created a subdir and put them in that.<br />
As is, I don’t like misc files sitting in the root of my config dir.</p>
</blockquote>
<p dir="auto">Agree. It could get very messy if scripts follow the trend including this script.</p>
<p dir="auto">The name of this subdir could be <code>Config\MacroInspect</code> though I consider that as starting an ugly trend. Perhaps within the <code>Config\PythonScript\scripts\MacroInspect</code> though still the files are not scripts as they are data files.</p>
<p dir="auto">Perhaps a central subdir like <code>Config\Temp</code> and temporary data files go there. So a user can clean that directory periodically and the scripts can remake the data files from latest version content as needed. To save name collisions could possibly prefix the files with script name like <code>MacroInspect-Type0.json</code> for example. If a script does not remake the data files then this temp directory would not be good to use and so may need a subdir like <code>Config\Static</code> for example.</p>
<p dir="auto">The concept may need some confirmation before I modify the script to alter where the data files go else the script may make a mess with obsolete data files in the <code>Config</code> directory.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98963</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98963</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Sat, 04 Jan 2025 02:37:10 GMT</pubDate></item></channel></rss>