Community
    • Login

    line by line modification using macro

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 5 Posters 2.9k Views
    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.
    • Faisal KhanF
      Faisal Khan
      last edited by

      Hello, I have tried but was not successful…
      I have a list of links , for example following ( three shown but they can be any number)

      https://i.imgur.com/ZbiS6MR.png
      https://i.imgur.com/Xjdr5eq.jpg
      https://i.imgur.com/ZehH59y.png

      I would like to paste them in notepad++ blank file starting with first row. I would like to run macro so that notepad can add bracket before and after i.e “(” in beginning of each line and “)” at the end of each line and give me the output. so output should be following
      (https://i.imgur.com/ZbiS6MR.png)
      (https://i.imgur.com/Xjdr5eq.jpg)
      (https://i.imgur.com/ZehH59y.png)

      The old lines should be deleted. This should be done on any number of rows pasted in that document.

      astrosofistaA 1 Reply Last reply Reply Quote 0
      • caryptC
        carypt
        last edited by

        your image-link show me no code or text nor number . some random trash is displayed instead . no data , no advice for no data . sry :)

        Faisal KhanF 1 Reply Last reply Reply Quote 0
        • Faisal KhanF
          Faisal Khan @carypt
          last edited by

          @carypt sorry, these links are just examples, no need to see data …as they are not related to the purpose of the question. The purpose is to append certain character to the beginning and end of a line. Visiting these links would not help in any way answering the question.

          1 Reply Last reply Reply Quote 0
          • TroshinDVT
            TroshinDV
            last edited by

            @Faisal-Khan said in line by line modification using macro:

            The old lines should be deleted. This should be done on any number of rows pasted in that document.

            I do a similar job using MS Excel and its Concatenate function.
            I have a trdmBrackets.js script in my repository that does a similar job, but to select either one line.
            alt text
            You can also modify it to process all the text.

            1 Reply Last reply Reply Quote 1
            • Faisal KhanF
              Faisal Khan
              last edited by

              thank you, can you guide , from where I can copy your script

              TroshinDVT 1 Reply Last reply Reply Quote 0
              • astrosofistaA
                astrosofista @Faisal Khan
                last edited by

                Hi @Faisal-Khan, All:

                As long as the data provided is representative, the following regex may do the job:

                Search: (?-s)^(https.+)$
                Replace: \($0\)
                

                Put the caret at the very beginning of the document, select just the Regular Expressions mode and click on Replace All. You can record it as a macro and save it for later use.

                Have fun!

                1 Reply Last reply Reply Quote 3
                • TroshinDVT
                  TroshinDV @Faisal Khan
                  last edited by

                  @Faisal-Khan said in line by line modification using macro:

                  thank you, can you guide , from where I can copy your script

                  My script works in conjunction with the jN plugin as well as some ActiveX, so its installation is difficult for a beginner. Additionally, I just made edits in the local repository to frame all lines. You will need to update the repo on GitHib.

                  1 Reply Last reply Reply Quote 0
                  • Alan KilbornA
                    Alan Kilborn
                    last edited by

                    A script feels a bit “heavy” for this simple operation.
                    I’d go with the regular-expression-replace method.
                    If it is a recurring need, record a macro out of it, then it will appear in a menu, a bit like the script’s (again showing that the simpler solution is probably better in this case).

                    TroshinDVT 1 Reply Last reply Reply Quote 0
                    • TroshinDVT
                      TroshinDV @Alan Kilborn
                      last edited by TroshinDV

                      @Alan-Kilborn said in line by line modification using macro:

                      A script feels a bit “heavy” for this simple operation.

                      This is if we mean only this operation.
                      In fact, there are many possibilities as the brackets are customizable.
                      Often it is necessary, for example: to complete the lines on the right or left.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors