Community
    • Login

    how to add more then 1024 new lines at once?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    21 Posts 6 Posters 3.4k 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.
    • Alan KilbornA
      Alan Kilborn @Neil Schipper
      last edited by

      @Neil-Schipper

      I think the OP was truly looking for a “one step” solution, and you neglected stating recording a macro as part of your instructions. So I tried your instructions while macro-recording, and yes, indeed, they worked when playing back – sometimes things don’t always work when recording, but this time they did!

      B MRB 1 Reply Last reply Reply Quote 2
      • B MRB
        B MR @Alan Kilborn
        last edited by

        @Alan-Kilborn
        sorry for the late response,

                <Macro name="new" Ctrl="no" Alt="no" Shift="no" Key="0">
                    <Action type="0" message="2451" wParam="0" lParam="0" sParam="" />
                    <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x000A;&#x000A;&#x000A;&#x000A;&#x000A;&#x000A;&#x000A;&#x000A;&#x000A;&#x000A;&#x000A;&#x000A;&#x000A;&#x000A;" />
                </Macro>
        

        i try a few copies first… it only add 3 lines…

        guy038
        didn’t work for me

        neil
        i need it to apply on 300 lines, and it’s not practical to do it manually

        and also… correct me if i’m wrong, but did all the macros above apply to one line only?
        i need it to apply in all the line in the file

        thanks for bearing with me

        PeterJonesP Alan KilbornA Neil SchipperN 3 Replies Last reply Reply Quote 0
        • PeterJonesP
          PeterJones @B MR
          last edited by

          @B-MR said in how to add more then 1024 new lines at once?:

          all the macros above apply to one line only

          Well, not “all”, as mine did every line, ad you said it worked for you.

          Think of the others as learning exercises, and see if you can extend them to work on all lines. (For example, down-arrow cursor movements can be recorded, so if you add that to a single-line macro, and then run that macro N times, where N is the number of lines in your file, then it should work. But get creative, and see if you can find alternatives)

          1 Reply Last reply Reply Quote 1
          • Alan KilbornA
            Alan Kilborn @B MR
            last edited by

            @B-MR said in how to add more then 1024 new lines at once?:

            i try a few copies first… it only add 3 lines…

            Hmm, I tried it and it added the correct number of lines…

            1 Reply Last reply Reply Quote 0
            • Neil SchipperN
              Neil Schipper @B MR
              last edited by Neil Schipper

              @B-MR said in how to add more then 1024 new lines at once?:

              it’s not practical to do it manually

              After you create the 3k empty lines in a new file, something you do once, you have all kinds of freedom.

              You can Select All, Copy, then change tabs to your working file, and paste the 3k lines anywhere you want.

              You can create a macro that does all kinds of things, including a pasting action. If clipboard is preloaded with the 3k lines, and the macro does not disturb the clipboard, there are many possibilities, including Find operations combined with paste operations, and, running the macro repeatedly as per Alan’s first post.

              You can save the 3k lines file to 3kLines.txt (etc) and have it on hand for reuse if this insertion process you are now attempting is something you expect to be doing often.

              It’s possible I (we?) don’t really understand your need. You have said very little about the file you are starting with, and what it should look like after the process.

              (Edit: oops, I repeated stuff Peter already said. And I agree with him that you need to show some creativity now that you have all these building blocks.)

              B MRB 1 Reply Last reply Reply Quote 1
              • B MRB
                B MR @Neil Schipper
                last edited by B MR

                everybody…
                i trust everything you said and tried is right…
                don’t know why it doesn’t working for me,
                anyway…
                for the meantime i’ll stick with peter solution

                thank you all!

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

                  Hi, @b-mr,

                  You said :

                  guy038
                  didn’t work for me

                  So, I re-tried my macro and it worked as expected : it correctly inserted 3,000 empty lines, containing only the two chars \r\n !

                  Don’t know why it didn’t work on your configuration ? Probably, you did not insert the macro within the right shortcuts.xml file !

                  Best REgards,

                  guy038

                  PeterJonesP 1 Reply Last reply Reply Quote 0
                  • PeterJonesP
                    PeterJones @guy038
                    last edited by

                    @guy038

                    Your macro inserts 3000 newlines, plus maybe some other stuff (depending on where the cursor is) from one original line. (We’ll come back to that.)

                    But, as the poster said in one of the replies,

                    i need it to apply on 300 lines

                    Your macro only inserts the characters once. (Even before this, the original question involved searching for $, which is the end of each line in the file. That’s why I made my original solution do the replacement for every newline in the file – well, really, my original was for every literal dollar-sign, because I wasn’t thinking straight… but I corrected that in my postscript.)

                    So the OP would have to manually run your macro 300 times to add 3000 newlines after each of the 300 lines in the file. My macro converts every newline in the file to ~3000 newlines in one run.

                    I said in this post,

                    plus maybe some other stuff … (We’ll come back to that.)

                    Start with the file

                    one
                    

                    Put the cursor between the o and the n and run your macro: there are 3000 lines of o followed by ne

                    Undo. Put the cursor after the e. Run your macro. There are now 3000 lines of one followed by one blank line (if there was already a newline after the one)

                    Undo. Put the cursor before the o. This is the only position that makes 3000 empty lines. But it puts the empty lines before one. The original statement, by regex searching for $, originally implied that the desire was to make this change at the end of the line, not the beginning.

                    And, as I said earlier, the desire was for every EOL in the file to become 3000 newlines instead, which yours does not do in a single run.

                    And as I said to @B-MR , if you added a “down arrow” to the end of the macro (<Action type="0" message="2300" wParam="0" lParam="0" sParam="" />), saved the shortcuts file, restart notepad++: now given the file

                    one
                    two
                    three
                    

                    If you put the cursor before the t of two, and use Macro > Run a Macro Multiple Times, choose the Insert and Select 3,000 WINDOWS Line-Breaks from the pulldown list, and then choose Run until the end of the file
                    4ad0cc2c-e532-440a-a8af-1cfa15814b91-image.png

                    If you do that, then the end result will be one followed by 3000 blank lines, then two followed by 3000 blank lines, then three followed by 3000 blank lines.

                    1 Reply Last reply Reply Quote 1
                    • Paul WormerP
                      Paul Wormer
                      last edited by

                      @PeterJones Maybe the following is a useful clarifying remark to your solution. Because I did not know the word “pilcrow”, I googled it and found that it is the technical term for “paragraph sign” (¶). I presume that more non-native speakers of English besides myself don’t know it. One can enter the symbol by hitting alt-20 (2 and 0 on the numeric keypad while keeping alt pressed).

                      Alan KilbornA PeterJonesP 2 Replies Last reply Reply Quote 0
                      • Alan KilbornA
                        Alan Kilborn @Paul Wormer
                        last edited by

                        @Paul-Wormer said in how to add more then 1024 new lines at once?:

                        Maybe the following is a useful clarifying remark to your solution. Because I did not know the word “pilcrow”…

                        I don’t know that knowing the definition of the word is all that clarifying in regards to inserting a given number of blank lines.

                        Perhaps more clarifying would be knowing why Peter used the pilcrow character in the first place. He did this because he wanted to use a character that is unlikely to be an existing character in a user’s document. This is so the replacement operations don’t accidentally hit characters that aren’t part of the solution proposed.

                        1 Reply Last reply Reply Quote 1
                        • PeterJonesP
                          PeterJones @Paul Wormer
                          last edited by PeterJones

                          @Paul-Wormer said in how to add more then 1024 new lines at once?:

                          @PeterJones Maybe the following is a useful clarifying remark to your solution. Because I did not know the word “pilcrow”, I googled it and found that it is the technical term for “paragraph sign” (¶). I presume that more non-native speakers of English besides myself don’t know it. One can enter the symbol by hitting alt-20 (2 and 0 on the numeric keypad while keeping alt pressed).

                          I’m sorry. I thought in context, where I had 15 ¶ symbols in the replacement, followed by the description that the replacement put in 15 pilcrow symbols, that it would correlate the ¶ symbol with the word “pilcrow”, even if as a non-native or native English speaker you did not know that technical term.

                          Also, one can get the “pilcrow” / “paragraph sign” by copy/pasting the exact sequences I used in my post. (I personally have windows builtin charmap.exe as one of my saved Notepad++ Run-menu entries so that I can easily run the charmap to find fancy characters while typing in Notepad++… and I have a script set up in PythonScript that will convert sequences like \0xXXXX or \u+XXXX into the unicode character at the hex codepoint XXXX.

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