Menu

Command Line - Open in different views

2008-02-03
2012-11-13
  • Nobody/Anonymous

    Is it possible to open for example 2 files in different views (yes/no)?

    Something like: notepad++.exe -openinviews "file1.txt" "file2.txt"

    ?

    Thank you,
    Thure

     
    • Nobody/Anonymous

      1. What exactly do you mean by 2 different views?
      2. Did you perhaps find anything about this or a similar question and answer on the forum?

       
    • Nobody/Anonymous

      Sorry for not expressing me clearly.

      I want to make a shortcut on my desktop, when clicking on it, it opens up 2 files in Notepad++ in split screen (the files in separate "Views").

      If i just make it like this:
      notepad++.exe "file1.txt" "file2.txt"
      it opens the 2 files in 2 tabs in the same "View". - Not what i need.

      My question again; is it possible to open 2 or more text files, where each text file opens in it's own "View"?

      Thank you,
      Thure

       
      • Nobody/Anonymous

        OK, this one is easy, I guess. Open both files in Notepad++ like you want. Save the session via the File menu. Add the name of the .session file to the N++ shortcut, instead of both filenames.

        If you do it correctly, this should work.
        You can test this behavior by setting the option to automatically save the session (opened files) when N++ is closed. When you restart N++, this should result in what you want. Then close N++ again and copy or rename the session.xml file to newname.session.

         
        • Nobody/Anonymous

          Okay thanks, i think this could work.

          One last question: How can you from a shortcut on the Desktop open a .session file as a session (aka "Load Session") instead of opening the .session file as a normal xml text file?

          Thank you,
          Thure

           
          • Nobody/Anonymous

            I just renamed my session.xml file to session.session, right-clicked on it and choose "Edit with Notepad++". For some seconds, nothing seemed to happen and I wondered if perhaps Notepad++ was in some kind of a loop, but then there it was: Notepad++ had just successfully opened and restored the session that I had saved before. I could go on where I left before when exiting Notepad++.

            So I guess also "[PathTo]Notepad++.exe sessionfilename.session" should do the trick, as implied by the earlier description...
            I tried it from the command line, but got a message saying "[LastOpenedPathPreviouslyInNotepad++]\sessionfilename.session doesn't exist. Do you want to create it?". I answered No, but Notepad++ seemed to have opened the correct session again. Referencing this last operation directory is known behavior, but could be improved or fixed.

             
            • Nobody/Anonymous

              Perhaps you (still) have to set the session file extension to ".session".
              Menu:___ Settings
              Option:_ Preferences
              Tab:____ MISC
              Feature: Session file ext: (lower right corner)

               
              • Nobody/Anonymous

                Yes, I needed to set session file extension to ".session".

                Notepad++ -> Settings -> Preferences -> MISC -> Session file ext=.session

                Thanks,
                Thure