How to read every line in a file edit box
-
How to read every line in a file edit box
Notepad++ can open many files at once.
Now I want to traverse every line of each opened file.
What function do I need to call?
I don’t want to read files directly from the hard drive.
I need to read them from the memory interface through an API
What function should be called? -
@heraldww said in How to read every line in a file edit box:
How to read every line in a file edit box
Notepad++ can open many files at once.
Now I want to traverse every line of each opened file.
What function do I need to call?
I don’t want to read files directly from the hard drive.
I need to read them from the memory interface through an API
What function should be called?I assume you’re talking about writing a plugin or a script. I can give you a clue regarding plugins; the script logic should be similar, but I don’t know the details.
To get the contents of an active tab, use SCI_GETTEXT or SCI_GETLINE, along with other functions you’ll find described nearby in the same document to get the length of the text or the number of lines.
Notepad++ keeps one or two views open, with a Scintilla control in each view and the document of the active tab in that view loaded into the Scintilla control; the documents in the other tabs are not loaded into Scintilla controls, and to the best of my knowledge there is no way to read their contents without loading them into a Scintilla control.
You can switch active tabs, though, and thereby traverse all open files. I don’t have an example handy, but the information you need is in this Notepad++ documentation.
NPPM_GETNBOPENFILES will tell you how many files are open in each view, and NPPM_ACTIVATEDOC will activate a specific document, so that should get you most of the way there.