How to operate on multiple editors simultaneously?

2013-10-11
2013-10-15
  • Thomson Tan
    Thomson Tan
    2013-10-11

    I'd like to merge contents from many editor (more than 2) to 1 via Python script for notepad++, but I only found editor is usable. I can work around this by switch to other windows and save its content before processing in the current window, but this way I cannot leverage the editor operation for others Window. Is there a way to operation on multiple editors simultaneously at the same time keep the current editor active? Such as alias of editor1, editor2, editor3, etc.

    Thanks.

     
  • The "editor" object refers to the Scintilla control. Notepad++ has exactly 2 Scintilla controls visible to the user (when you right click a tab, and "move to other view", you can see the second scintilla control). Using editor1 and editor2 allow you to interact with these two windows. "editor" always refers to the active window. Other tabs are handled as multiple documents within the same scintilla control (the control stays the same, and just the document is switched out). See http://www.scintilla.org/ScintillaDoc.html#MultipleViews for information about how scintilla handles that internally.

    You can use the "notepad" object to switch the current document, and then use the editor object as normal. Alternatively, you can create a new Scintilla control, with notepad.createScintilla(), then set the doc pointer to the same as the doc pointer you want to edit, then use this "hidden" scintilla as your editor object. I've never tried setting doc pointers through Python, but there's no reason why it wouldn't work.

    Dave.

     
    • Dev Player
      Dev Player
      2013-10-15

      Also in Notepad++ you can drag any (document) tab to the desktop to open a
      new Notepad++ process that has that tab as its primary document. Be aware
      the notepad++ can get confused (secretly that means the user) as to which
      notepad++ process "controls" how notepad++ opens the next time. Also I
      think there is a special command line argument or notepad++ setting that
      specifically is related to multiple notepad++ processes running
      concurrently.