How many files are opened (show number)



  • Hello, @m-fr and All,

    Michaela, since the 7.9.2 release of Notepad++ a new functionality have been added :

    Point 16. Add the number of total documents on windows dialog's title bar of the change.log file


    So, to get the total number of the opened documents of the main view OR the secondary view :

    • Run the menu option Windows > Windows...

    • Hit the shortcut ALT , W , W

    In the title bar of the dialog, you’ll see the text Windows - Total documents: ##

    Best Regards,

    guy038



  • @Alan-Kilborn said in How many files are opened (show number):

    BTW, anybody else think that “Window” is a bad name for this, all the way through? Wouldn’t “Tab” have been better nomenclature?

    Depends on your perspective. In the Win32 API environment, “tabs” are just “windows” that are restricted within some parent window. The “Window” menu item has a long-standing Win32 application history as the location to go in any Win32 application to manipulate which files or tabs or windows are active or ordered or what have you, even though in most modern apps, “Tabs” would make more sense.



  • As a user, do I even care if it’s called tab or window?
    Imho it doesn’t provide any additional information to the user.
    I would just call it total documents: X



  • @Ekopalypse

    I was referring to the Window menu.
    And then the Window… item on the Window menu.
    And then the Windows - … in the title bar of the window that pops up.

    The “total documents: X” thing is just fine, although for it to be nomenclature consistent it should be Windows - total windows: X :-)

    “window” is just a bit too generic.
    More evidence is people that talk of “multi-instance” as “I have 2 N++ windows open”.

    Of course, this whole thing I started is rather pointless, as it isn’t going to be changed.
    But if it were, a Documents menu, and using that below it, would be nice.
    But in Preferences the “tab bar” nomenclature is used, so in the end perhaps “Tab” would be best…

    BUT WHO CARES BECAUSE NOTHING WILL CHANGE? :-) And I’m not even advocating for change. :-)

    @PeterJones

    Yes, of course, history of “window” noted.



  • @Alan-Kilborn said in How many files are opened (show number):

    I was referring to the Window menu.

    Ahh ok - misunderstanding.



  • Hello,@M-FR
    The reason is that the operating system needs memory to manage each open file, and memory is a limited resource - especially on embedded systems.

    As a root user, you can change the maximum of the open file count per process (via ulimit -n) and per system.

    I hope this information will be useful to you.
    Thank you.



  • Hi everybody

    Thanks, that was all very interesting. The thing I’ll go for is first of all to get the newest version as I only have 7.8.6 and as @guy038 wrote, I’ll need a newer version for the thing I need.

    Thanks to all of you, great support here for a notepadd++ newbie :-)

    Michaela



  • @Alan-Kilborn said in How many files are opened (show number):

    BTW, anybody else think that “Window” is a bad name for this, all the way through? Wouldn’t “Tab” have been better nomenclature?

    @guy038: Beat you to it! :-)

    Yes, me, and this naming is also confusing in the window itself.
    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/8339
    To be more precise, it displays the tabs in the current view (not both views).



  • @M FR
    You can also use some script to dispaly such info in status bar or in other form, more detail in this bug:
    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/8338



  • Hi @M-FR

    For different reasons as yours, I found this information useful to my working setup, so and though I am not a real programmer, managed anyway to write — based on countless examples buried in the forum archives — this little Python script, tested in npp7.9.1.portable.x64, which will show how many files are opened in the status bar.

    If there is any issue with it, lets hope that the Pythoniers of the forum chime in.

    from Npp import *
    
    def StatusbarFilesAddition(args):
        Cur_Lang = notepad.getLanguageDesc(notepad.getLangType())
        Open_Files = 0
        for file in notepad.getFiles():
            Open_Files += 1
    
        notepad.setStatusBar(STATUSBARSECTION.DOCTYPE, '{}   -   Open files: {}'.format(Cur_Lang, Open_Files))
    
    editor.callback(StatusbarFilesAddition, [SCINTILLANOTIFICATION.UPDATEUI])  # register callback
    

    If you want to try the script, here are some instructions to install it:

    First off, install PythonScript using Plugins > Plugins Admin.

    Then go to Plugins > Python Script > Scripts, Ctrl+Click on startup, and paste the script at the bottom of the file. Save and close startup.

    Now go to Plugins > Python Script > Configuration…, and change the “Initialisation” setting from LAZY to ATSTARTUP. Exit Notepad++ and reload.

    From now on the first section of the status bar will show how many files are opened in Notepad++ after the current language.

    Take care and have fun!


Log in to reply