<?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[Open files with NPP_EXEC then switch to the tab of the first opened file?]]></title><description><![CDATA[<p dir="auto">I have an NPP_EXEC script tied to a Customize Toolbar button that opens a set of files using NPP_OPEN.  The files are opened in a specific order.  But after they’re all open, I want focus to switch to the first tab (the first file opened), not left on the last tab (the last file opened).  Nothing the internet has suggested will switch the tab for me.  Is there a command I’ve missed to do that?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/27181/open-files-with-npp_exec-then-switch-to-the-tab-of-the-first-opened-file</link><generator>RSS for Node</generator><lastBuildDate>Sat, 06 Jun 2026 10:48:35 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/27181.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 10 Oct 2025 15:42:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Open files with NPP_EXEC then switch to the tab of the first opened file? on Sat, 11 Oct 2025 14:49:54 GMT]]></title><description><![CDATA[<p dir="auto">I’ve added this case to the Manual!<br />
<a href="https://d0vgan.github.io/nppexec/?q=4.6.20" rel="nofollow ugc">https://d0vgan.github.io/nppexec/?q=4.6.20</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/103479</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/103479</guid><dc:creator><![CDATA[Vitalii Dovgan]]></dc:creator><pubDate>Sat, 11 Oct 2025 14:49:54 GMT</pubDate></item><item><title><![CDATA[Reply to Open files with NPP_EXEC then switch to the tab of the first opened file? on Fri, 10 Oct 2025 21:19:34 GMT]]></title><description><![CDATA[<p dir="auto">Just for information, <code>npp_switch $(#$(file_idx))</code> becomes e.g. <code>npp_switch $(#5)</code> when <code>$(file_idx) = 5</code>.<br />
This trick is called “indirect variable reference, e.g. $($(name))” and was added in NppExec v0.6.2.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/103472</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/103472</guid><dc:creator><![CDATA[Vitalii Dovgan]]></dc:creator><pubDate>Fri, 10 Oct 2025 21:19:34 GMT</pubDate></item><item><title><![CDATA[Reply to Open files with NPP_EXEC then switch to the tab of the first opened file? on Fri, 10 Oct 2025 21:17:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vitalii-dovgan" aria-label="Profile: Vitalii-Dovgan">@<bdi>Vitalii-Dovgan</bdi></a> said in <a href="/post/103470">Open files with NPP_EXEC then switch to the tab of the first opened file?</a>:</p>
<blockquote>
<p dir="auto">npp_switch $(firstFileToOpen)</p>
</blockquote>
<p dir="auto">Thank you! That’s exactly what I was looking for.</p>
<p dir="auto">And I really thought after reading your reply that I’d tried that one already, but since it’s now working, I must have missed it.</p>
<p dir="auto">Thank you again.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/103471</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/103471</guid><dc:creator><![CDATA[VTGroupGitHub]]></dc:creator><pubDate>Fri, 10 Oct 2025 21:17:35 GMT</pubDate></item><item><title><![CDATA[Reply to Open files with NPP_EXEC then switch to the tab of the first opened file? on Fri, 10 Oct 2025 21:10:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vtgroupgithub" aria-label="Profile: VTGroupGitHub">@<bdi>VTGroupGitHub</bdi></a><br />
If I understand you correctly, you need <code>npp_switch</code>:</p>
<pre><code>set local firstFileToOpen = path_to_the_first_file_to_open
// now opening the files via npp_open
npp_switch $(firstFileToOpen)
</code></pre>
<p dir="auto">If, however, you don’t know the firstFileToOpen in advance - for example, if npp_open uses a file mask, you can remember the number of opened files before npp_open and then switch to the number+1 document after npp_open:</p>
<pre><code>// 1. remembering num_opened_files 
npp_sendmsg NPPM_GETCURRENTSCINTILLA 0 @0
set local view ~ $(MSG_LPARAM) + 1
npp_sendmsg NPPM_GETNBOPENFILES 0 $(view)
set local num_opened_files = $(MSG_RESULT)

// 2. calling npp_open
// ...

// 3. switching to a (num_opened_files + 1)th document
set local file_idx ~ $(num_opened_files) + 1
npp_switch $(#$(file_idx))
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/103470</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/103470</guid><dc:creator><![CDATA[Vitalii Dovgan]]></dc:creator><pubDate>Fri, 10 Oct 2025 21:10:35 GMT</pubDate></item></channel></rss>