Community
    • Login

    run macro headlessly on specified file

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 2.4k 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.
    • Cybersquir CybersquirC Offline
      Cybersquir Cybersquir
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • guy038G Online
        guy038
        last edited by guy038

        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

        1 Reply Last reply Reply Quote 0

        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