Select all text on all open files?



  • Is there a way to select all text on all open files?

    Is there a way to run a menu command on all of these selected texts?



  • I’m looking blindly at the jN code

    URLDecoderEncoder.addItem({
        text: 'Decode',
        cmd: function() {
            var encoded = Editor.currentView.text;
            var unencoded = decodeURIComponent(encoded);
            Editor.currentView.text = unencoded;
        }
    

    , out of stackoverflow. They said there that Editor.currentView.text is the value that specify the text of the entire file. Can it be changed to be broader than currentView ?



  • @trespda

    I’m not familiar with jn plugin but in order to get the text from all
    open documents you have to iterate over all open files.
    Npp offers an API to retrieve the open files.



  • @Ekopalypse

    Npp offers an API to retrieve the open files.

    Would this mean keeping the files as files in their tabs, or retrieving the texts from all files to a new file?



  • Not quite sure I understand.
    The workflow is like this

    • get number of open files (NPPM_GETNBOPENFILES)
    • retrieve the bufferids for these files (NPPM_GETOPENFILENAMESPRIMARY/NPPM_GETOPENFILENAMESSECOND, NPPM_GETBUFFERIDFROMPOS)
    • activate the bufferids (NPPM_ACTIVATEDOC)
    • read the content (SCINTILLA API GetTextT)

Log in to reply