<?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[NPPexec Tidy won&#x27;t open html file.]]></title><description><![CDATA[<p dir="auto">I used to have an NPPexec macro which ran an external Tidy on the current file and displayed Tidy messages in the console. My computer crashed so hard I couldn’t restore from an image, so I did a clean Win11 install. I’m trying to replace that macro.<br />
I dug up a few versions on the Web but they all have the same problem. Here’s what I have now:</p>
<pre><code>// 1. Temporarily save the current document state
NPP_SAVE
// 2. Run Tidy silently, format the active file, and overwrite it
"C:\Program Files (x86)\tidy-5.4.0\bin\tidy.exe"  -modify -indent --indent-spaces 2 --wrap 120 "$(FULL_CURRENT_PATH)"
// 3. Force Notepad++ to reload the updated text cleanly
NPP_OPEN "$(FULL_CURRENT_PATH)
// 4. to see the formatted changes
NPP_RELOAD
</code></pre>
<p dir="auto">Which results in:</p>
<pre><code>NPP_SAVE: C:\Temporary\BitToggle.html
"C:\Program Files (x86)\tidy-5.4.0\bin\tidy.exe"  -modify -indent --indent-spaces 2 --wrap 120 "C:\Temporary\BitToggle.html"
Process started (PID=33372) &gt;&gt;&gt;
Error: Can't open "C:\Temporary\BitToggle.html"

About HTML Tidy: https://github.com/htacg/tidy-html5
Bug reports and comments: https://github.com/htacg/tidy-html5/issues
Official mailing list: https://lists.w3.org/Archives/Public/public-htacg/
Latest HTML specification: http://dev.w3.org/html5/spec-author-view/
Validate your HTML documents: http://validator.w3.org/nu/
Lobby your company to join the W3C: http://www.w3.org/Consortium

Do you speak a language other than English, or a different variant of 
English? Consider helping us to localize HTML Tidy. For details please see 
https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md
&lt;&lt;&lt; Process finished (PID=33372). (Exit code 2)
NPP_OPEN: "C:\Temporary\BitToggle.html
NPP_RELOAD
; about to start a child process: "NPP_RELOAD"
CreateProcess() failed with error code 2:
The system cannot find the file specified.

================ READY ================
</code></pre>
<p dir="auto">Of course the freakin’ file exists, I’m editing it in Notepad++ x86. WTF?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/27592/nppexec-tidy-won-t-open-html-file.</link><generator>RSS for Node</generator><lastBuildDate>Wed, 01 Jul 2026 19:48:34 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/27592.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 Jul 2026 13:52:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to NPPexec Tidy won&#x27;t open html file. on Wed, 01 Jul 2026 16:13:44 GMT]]></title><description><![CDATA[<p dir="auto">Thanks, your script works perfectly.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/105810</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/105810</guid><dc:creator><![CDATA[Jon Fleming]]></dc:creator><pubDate>Wed, 01 Jul 2026 16:13:44 GMT</pubDate></item><item><title><![CDATA[Reply to NPPexec Tidy won&#x27;t open html file. on Wed, 01 Jul 2026 15:32:07 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">Which results in:</p>
<pre><code>NPP_SAVE: C:\Temporary\BitToggle.html
"C:\Program Files (x86)\tidy-5.4.0\bin\tidy.exe"  -modify -indent --indent-spaces 2 --wrap 120 "C:\Temporary\BitToggle.html"
Process started (PID=33372) &gt;&gt;&gt;
Error: Can't open "C:\Temporary\BitToggle.html"
</code></pre>
</blockquote>
<p dir="auto">I don’t know why you got that. If you open cmd.exe (not in Notepad++) and send <code>"C:\Program Files (x86)\tidy-5.4.0\bin\tidy.exe"  -modify -indent --indent-spaces 2 --wrap 120 "C:\Temporary\BitToggle.html"</code> , does it give the same error?  Because if it gives an error there, then there is something wrong in the tidy syntax; but if that command <em>doesn’t</em> given an error in cmd.exe, then we need to try to figure out what’s actually different between the two.</p>
<p dir="auto">Assuming the command works when BitToggle.html is <em>not</em> open in Notepad++ and you run that command from the cmd.exe command line, my initial guess is that <code>tidy.exe</code> wants an exclusive lock on the file, and if it’s open in Notepad++, then it can’t get that lock.  But that’s just a guess.  So the first thing you need to do is confirm whether or not the command works when it <em>doesn’t</em> involve Notepad++ or NppExec.</p>
<blockquote>
<pre><code>NPP_OPEN: "C:\Temporary\BitToggle.html
NPP_RELOAD
; about to start a child process: "NPP_RELOAD"
CreateProcess() failed with error code 2:
The system cannot find the file specified.
</code></pre>
</blockquote>
<p dir="auto">That one’s easier: there’s a missing endquote.  In your script, you showed:</p>
<blockquote>
<pre><code>// 1. Temporarily save the current document state
NPP_SAVE
// 2. Run Tidy silently, format the active file, and overwrite it
"C:\Program Files (x86)\tidy-5.4.0\bin\tidy.exe"  -modify -indent --indent-spaces 2 --wrap 120 "$(FULL_CURRENT_PATH)"
// 3. Force Notepad++ to reload the updated text cleanly
NPP_OPEN "$(FULL_CURRENT_PATH)
// 4. to see the formatted changes
NPP_RELOAD
</code></pre>
</blockquote>
<p dir="auto">Do you notice on the <code>NPP_OPEN</code> line?  There is no closing quote after the <code>$(FULL_CURRENT_PATH)</code>, and command interpreters do strange things with unclosed quotes.  So add that endquote.</p>
<blockquote>
<pre><code>NPP_RELOAD
</code></pre>
</blockquote>
<p dir="auto">Did you get this from AI?  Because <a href="https://github.com/search?q=repo%3Ad0vgan%2Fnppexec+NPP_RELOAD&amp;type=code" rel="nofollow ugc">NPP_RELOAD</a> is not found anywhere in the NppExec repository.  I think your AI may have hallucinated that.</p>
<p dir="auto">If I use <strong>Plugins &gt; NppExec &gt; Help/Manual</strong> and go to section <strong>4. Advanced Usage &gt; 4.6. Using external tools &gt; 4.6.15. Triggering certain actions while saving a file</strong> (*), about halfway down, I find <code>npp_sendmsg NPPM_RELOADFILE 0 "$(FULL_CURRENT_PATH)"</code> as the syntax for reloading a file.  (*: no, I didn’t <em>find</em> it that way; I searched the manual for <code>reload</code>, and that’s just the section that had it.)</p>
<p dir="auto">So, assuming the <code>tidy.exe</code> syntax is correct, then the script should be:</p>
<pre><code>// 1. Temporarily save the current document state
NPP_SAVE
// 2. Run Tidy silently, format the active file, and overwrite it
"C:\Program Files (x86)\tidy-5.4.0\bin\tidy.exe"  -modify -indent --indent-spaces 2 --wrap 120 "$(FULL_CURRENT_PATH)"
// 3. Force Notepad++ to reload the updated text cleanly
NPP_OPEN "$(FULL_CURRENT_PATH)"
// 4. to see the formatted changes
NPP_SENDMSG NPPM_RELOADFILE 0 "$(FULL_CURRENT_PATH)"
</code></pre>
<hr />
<p dir="auto">I just went to the <a href="https://binaries.html-tidy.org/" rel="nofollow ugc">https://binaries.html-tidy.org/</a> and unzipped tidy 5.4 (I put it in <code>c:\usr\local\apps\tidy-5.4.0\</code>), and created a <code>C:\Temporary\BitToggle.html</code> with some HTML in it.  When I ran the script I showed (but with my path to tidy.exe rather than yours), it worked for me:</p>
<pre><code>NPP_SAVE: c:\Temporary\BitToggle.html
"C:\usr\local\apps\tidy-5.4.0\tidy.exe"  -modify -indent --indent-spaces 2 --wrap 120 "c:\Temporary\BitToggle.html"
Process started (PID=20256) &gt;&gt;&gt;
Info: Document content looks like HTML5
No warnings or errors were found.


About HTML Tidy: https://github.com/htacg/tidy-html5
Bug reports and comments: https://github.com/htacg/tidy-html5/issues
Official mailing list: https://lists.w3.org/Archives/Public/public-htacg/
Latest HTML specification: http://dev.w3.org/html5/spec-author-view/
Validate your HTML documents: http://validator.w3.org/nu/
Lobby your company to join the W3C: http://www.w3.org/Consortium

Do you speak a language other than English, or a different variant of 
English? Consider helping us to localize HTML Tidy. For details please see 
https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md
&lt;&lt;&lt; Process finished (PID=20256). (Exit code 0)
NPP_OPEN: c:\Temporary\BitToggle.html
NPP_SENDMSG: NPPM_RELOADFILE 0 "$(FULL_CURRENT_PATH)"
================ READY ================
</code></pre>
<p dir="auto">So that works for me.  Given that it worked from NppExec with it open in Notepad++ for me, I don’t know why you got the first error when you ran the script…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/105806</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/105806</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 01 Jul 2026 15:32:07 GMT</pubDate></item></channel></rss>