How to close ONE Tab from NP++ from cmdline/commandprompt?

  • Is there a way to close (from DOS batch file resp. from Command prompt) exactly one particular tab with e.g.the label/title/open file “aaaa.txt”?

    …how can I force NP++ to close it silently even if there is unsaved content in it (=then discard it automatically)?

    Is there a way to automatically close this tab from INSIDE NP++ after a certain time of inactivity (=no mouse movements)?

  • There isn’t a builtin way (ie, you cannot just re-run notepad++.exe with a command-line option to close a specific file). If you know of a way to send Windows API messages from the DOS batch file and/or command prompt, then you could possibly send a message to the appropriate component to close that file inside Notepad++. But any such way that I could imagine would require a fairly strong knowledge of the Windows API and messaging system, and probably knowing a programming language beyond batch file (probably via powershell script, and I’m quite sure through VBScript, Python, Perl, Lua, or any number of other full-featured programming languages).

    Purely inside vanilla Notepad++, there isn’t a way to set a auto-close-based-on-inactive-time. Using the PythonScript plugin (or LuaScript plugin), which combines the power of the Python (or Lua, respectively) programming language with direct access to the Notepad++ GUI and editor (scintilla) components, you might be able to create a script using callbacks (described in the PythonScript documentation), plus Python timer-based actions, to take care of that; but it’d be a complicated

Log in to reply