Community
    • Login

    Suggestion: Option to Close All before Session Load

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    15 Posts 4 Posters 964 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dwayne RobertsD
      Dwayne Roberts
      last edited by

      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!

      EkopalypseE 1 Reply Last reply Reply Quote 0
      • EkopalypseE
        Ekopalypse @Dwayne Roberts
        last edited by

        @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.

        1 Reply Last reply Reply Quote 4
        • Dwayne RobertsD
          Dwayne Roberts
          last edited by

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

          EkopalypseE 1 Reply Last reply Reply Quote 0
          • EkopalypseE
            Ekopalypse @Dwayne Roberts
            last edited by

            @Dwayne-Roberts

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

            Dwayne RobertsD 1 Reply Last reply Reply Quote 0
            • Dwayne RobertsD
              Dwayne Roberts @Ekopalypse
              last edited by

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

              Alan KilbornA 1 Reply Last reply Reply Quote 0
              • Alan KilbornA
                Alan Kilborn @Dwayne Roberts
                last edited by

                @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?

                Dwayne RobertsD 2 Replies Last reply Reply Quote 1
                • Dwayne RobertsD
                  Dwayne Roberts @Alan Kilborn
                  last edited by

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

                  1 Reply Last reply Reply Quote 1
                  • Dwayne RobertsD
                    Dwayne Roberts @Alan Kilborn
                    last edited by

                    @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.

                    Alan KilbornA PeterJonesP 2 Replies Last reply Reply Quote 0
                    • Alan KilbornA
                      Alan Kilborn @Dwayne Roberts
                      last edited by

                      @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 RobertsD 1 Reply Last reply Reply Quote 1
                      • PeterJonesP
                        PeterJones @Dwayne Roberts
                        last edited by

                        @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).

                        PeterJonesP Dwayne RobertsD 2 Replies Last reply Reply Quote 0
                        • PeterJonesP
                          PeterJones @PeterJones
                          last edited by PeterJones

                          @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/;
                          notepad->closeAll();
                          notepad->menuCommand($NPPIDM{IDM_FILE_LOADSESSION});
                          

                          … 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.

                          Dwayne RobertsD 1 Reply Last reply Reply Quote 0
                          • Dwayne RobertsD
                            Dwayne Roberts @Alan Kilborn
                            last edited by

                            @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).

                            Alan KilbornA 1 Reply Last reply Reply Quote 0
                            • Dwayne RobertsD
                              Dwayne Roberts @PeterJones
                              last edited by

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

                              1 Reply Last reply Reply Quote 0
                              • Alan KilbornA
                                Alan Kilborn @Dwayne Roberts
                                last edited by

                                @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.

                                1 Reply Last reply Reply Quote 2
                                • Dwayne RobertsD
                                  Dwayne Roberts @PeterJones
                                  last edited by

                                  @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!

                                  1 Reply Last reply Reply Quote 1
                                  • First post
                                    Last post
                                  The Community of users of the Notepad++ text editor.
                                  Powered by NodeBB | Contributors