Running a macro on all open docs

  • Hi
    Is there a way to run a macro on all open documents? Currently I have to open each document to run a macro which is a pain. I’ve tried multi-selecting the tabs but that doesn’t work.

  • . . . or run a macro on all of the docs in a single folder . . . ?

  • Hello, Andy,

    I don’t think this is native feature of N++. But, I do agree, with you, that this feature could be very interesting !

    As a work-around, you could :

    • 1) Gather the contents of all your opened documents, in a new tab

    • 2) Run your macro, on this big file, ONLY

    • 3) Replace the original contents of each file, by each modified part : I know, quite tedious :-((

    The good news is that Claudia or Scott could build a Python script, or Dail with a Lua script, which would do all these steps, in one go :-)) At least, the steps 1 and 3, anyway !

    • We just need, in phase 1, to separate, in that big file, the contents of each individual file by inserting any header, with the name of the file( as, for instance, ======== sample.txt ========= ), followed by its contents

    • In phase 3, the script would replace all the contents of each individual file by the appropriate part ( known from the header ! ) of the complete file

    Best Regards,


  • Thanks for the reply! The individual files are XML order files and have lines which include the number of orders in that particular file. Merging them all into one wouldn’t be ideal without being able to extract them all after - possibly using a custom header as you mention. Ideally, the files also need to retain their filenames.

Log in to reply