Suggestion: Option to Close All before Session Load

  • My students sometimes (usually?) forget to close all files before loading a session. Then they get confused about which files are for the current class and which are left behind from the previous one. If there could be a binary option in Settings»Preferences…»MISC. to automatically do a Close All before loading a session, life would be grand!

  • @Dwayne-Roberts

    I don’t know if this is practical in your case, but the Explorer plugin has a Favorites feature and you can save sessions there that behave exactly the way you want.

  • Sounds possible, but I doubt I can pre-load all their favorites. I’ll look into it deeper. Thanks!

  • @Dwayne-Roberts

    I was under the impression that sessions is what you provide as their lessons, isn’t it?

  • @Ekopalypse Yes. Each class they’ll load Session1 or Session2 or whatever to get the files for that class.

  • @Dwayne-Roberts

    I think @Ekopalypse and I have some uncertainty about the logistics of what you are trying to do on your end, but that’s for you to figure out.

    I’ll just add that the Explorer plugin stores its “favorites” data in a Favorites.dat file. Manipulating/placing that file might be key to what you’re wanting to do?

  • @Alan-Kilborn Sounds possible. I’ll check it out. Thanks.

  • @Alan-Kilborn I tried it out, adding three sessions. Is the favorites.dat file created automatically? Do you know where it’s located? (I couldn’t find it.)

    The way I’ve set up my remote class, my students download the course material which includes about a dozen session files onto their PC. For each class they run N++ and open the session file corresponding to that particular class. Then we work together remotely with that material.

  • @Dwayne-Roberts

    Go to the Plugins menu and choose Open Plugins Folder.
    In the (Microsoft) Explorer window that opens, open the Config folder that should be present. Favorites.dat should be in there if you are using the Explorer plugin.

    Note that I’m just providing some additional info on what @Ekopalypse started. I haven’t tried Eko’s original advice:

    the Explorer plugin has a Favorites feature and you can save sessions there that behave exactly the way you want.

    to verify that it does indeed behave in the manner you desire.

    Good luck.

  • @Dwayne-Roberts said in Suggestion: Option to Close All before Session Load:

    For each class they run N++ and open the session file corresponding to that particular class.

    If I understand correctly, they are starting Notepad++ from scratch every day? Then why not turn off Settings > Preferences > Backup > Remember Current Session for next launch? Every time Notepad++ gets opened, each student will have an empty set of files (ie, it will just have new 1), then File > Load Session… will open just that day’s files (new 1 disappears if it hasn’t been modified).

  • @Dwayne-Roberts ,

    … Or another idea, if they need the periodic backup (which requires remembering-session to be left on), then change the Notepad++ shortcut to include the -nosession argument, so when they launch from the shortcut at the beginning of the day, it doesn’t use yesterday’s session.

    … Or make a the shortcut point to a batch file which deletes %AppData%\Notepad++\session.xml before running notepad++.exe

    … Or set a Windows Task Scheduler task to delete the session file at logout (or at logon, or at 6am every day, or whatever’s appropriate)

    … Or you could use an external Perl instance with Win32::Mechanize::NotepadPlusPlus installed, to run the script

    use Win32::Mechanize::NotepadPlusPlus qw/:main/;

    … Or you could install one of the scripting Plugins, like PythonScript or LuaScript, using Plugins > Plugins Admin, and run a nearly-identical script to the above.

    Either of those last two could be set up to place an entry in the Macro or Run menus, and then assign a keyboard shortcut using Settings > Shortcut Mapper. If you want to go down one of those routes, let us know which would be your preferred language, and we can help you through making the menu entry and creating the shortcut. But the process varies

    edits: clarified a couple of things.

  • @Alan-Kilborn Curiously, even though I am using the Explorer plug-in, there’s no Favorites.dat file in the plugins (or in the plugins\Explorer) folder. Besides other folders such as APIs, Config, Explorer, NppExport, there’s a PluginManager.dll and an Explorer.dll. I did a fruitless Windows file search for Favorites.dat. I’m using N++ v7.8.6 (32-bit).

  • @PeterJones I can’t guarantee they’ll start N++ from scratch in between classes. They may in fact review the work we did together.

  • @Dwayne-Roberts

    there’s no Favorites.dat file

    Interesting. I presume you created some “test favorites” before looking for the file? Maybe restarting N++? Maybe it needs a reason to create the file before doing so.

    PluginManager.dll is obsolete and you shouldn’t be using it. Plugins Admin is the way to go now.

  • @PeterJones My preference would be for the Close All to be executed only when a new session is loaded, and then only optionally (either by a setting or a prompt). I think, for now I’ll just try to remind them at the beginning of each class to Close All before loading the new session. Thanks for the suggestions!

Log in to reply