Community
    • Login

    How to read every line in a file edit box

    Scheduled Pinned Locked Moved General Discussion
    2 Posts 2 Posters 569 Views 1 Watching
    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.
    • H Offline
      heraldww
      last edited by

      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?

      CoisesC 1 Reply Last reply Reply Quote 0
      • CoisesC Offline
        Coises @heraldww
        last edited by Coises

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

        1 Reply Last reply Reply Quote 4

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors