run macro headlessly on specified file



  • Hi
    Is there a way to run a notepad++ macro headlessly on a specified text file?

    Actually my problem is that I have a set of files on which I need to do the same treatment (remove 5 first lines and replace tabs by coma), and I would like to launch the execution of the job from an external program.
    I did a macro that does the treatment well, but my problem is that I have to open each file, launch the macro and then close the file. I would lilke to automatize that part as well.

    Thanks for your help



  • Hello Cybersquir,

    Why don’t you simply use the Find in Files dialog, with a suitable regular expression ? Of course, all your concerned files should be located in a same directory !

    IMPORTANT : As you intend to change many files, simultaneously, may I suggest you to do a copy of this directory, as a backup, first ?

    Now, open the Find in Files dialog ( CTRL + SHIFT + F )

    • Choose the absolute path of the folder, containing all your files

    • Possibly, filter with one or several specific extension(s)

    • Set the Regular expression search mode

    • Check/uncheck the other options, as needed

    Then, for instance :

    • To remove the first 5 lines of every file, of this folder, use :

    SEARCH \A(?:.*\R){5}

    REPLACE Nothing

    • To change some consecutive tabulation characters with a comma, use :

    SEARCH \t+

    REPLACE ,

    And so on…

    Best Regards,

    guy038


Log in to reply