• Login
Community
  • Login

macro carriage return = 
 with update v.8.5.3

Scheduled Pinned Locked Moved General Discussion
11 Posts 5 Posters 2.5k 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.
  • I
    isaac van den berg
    last edited by isaac van den berg Jun 1, 2023, 10:03 AM Jun 1, 2023, 9:58 AM

    i have this simple notepad macro i use for quite some time; it cleans up some clutter in copied text from the web with search and replace and adds some carriage returns.

    Since todays update to v8.5.3 it inserts ampersant#x000D;ampersant#x000A (see header ) as text instead of adding a real carriage return. Is there something in de default values i should change or has it to do with the fact that or is it some bug that’s sneaked in this update (in which case i’l revert to the previous version)?

    TIA Isaac

    A 1 Reply Last reply Jun 1, 2023, 10:58 AM Reply Quote 0
    • A
      Alan Kilborn @isaac van den berg
      last edited by Jun 1, 2023, 10:58 AM

      @isaac-van-den-berg

      It’s a FAQ.

      I 1 Reply Last reply Jun 1, 2023, 1:14 PM Reply Quote 0
      • I
        isaac van den berg @Alan Kilborn
        last edited by Jun 1, 2023, 1:14 PM

        @Alan-Kilborn thanxs for the tip; i didn’t know about shortcuts.xml. however, the actual replacement of character-codes as suggested in the faq did not work for me since it just replaced the old character-codes for the new character-codes, so i guess i have to change something else for that to work. but a testmacro with carriage-returns revealed that it actually inserted carriage returns in the xml file so i replaced the character-codes with carriage-returns and that restored the expected behaviour of he macro!

        I P 2 Replies Last reply Jun 1, 2023, 1:46 PM Reply Quote 0
        • I
          isaac van den berg @isaac van den berg
          last edited by Jun 1, 2023, 1:46 PM

          @isaac-van-den-berg i was actually too fast; since in copying the lines in the xml file it only inserts a linefeed; which gives problems copying the result to other windows programs via the clipboard…

          1 Reply Last reply Reply Quote 0
          • D
            datatraveller1
            last edited by Jun 1, 2023, 2:21 PM

            @isaac-van-den-berg You might want to have a look here:
            https://community.notepad-plus-plus.org/post/86489 - This is how I solved the issue with help of the FAQ.

            I 1 Reply Last reply Jun 1, 2023, 3:30 PM Reply Quote 1
            • I
              isaac van den berg @datatraveller1
              last edited by isaac van den berg Jun 1, 2023, 3:32 PM Jun 1, 2023, 3:30 PM

              @datatraveller1 thanx; with search and replace (in npp) i had to tick the “regular expressions” option (i had it on “extended”) and it worked. meanwhile in the macro i also have a search for 2 carriage returns and replace it with “carriage return - space - carriage return” and that didn’t work either. i’m reverting to the old version for the time being.

              1 Reply Last reply Reply Quote 0
              • P
                PeterJones @isaac van den berg
                last edited by PeterJones Jun 1, 2023, 3:36 PM Jun 1, 2023, 3:32 PM

                @isaac-van-den-berg said in macro carriage return = 
 with update v.8.5.3:

                thanxs for the tip; i didn’t know about shortcuts.xml. however, the actual replacement of character-codes as suggested in the faq did not work for me since it just replaced the old character-codes for the new character-codes

                Then you did not follow the FAQ correctly, because the replacements shown, when run in regular expression mode (as the FAQ said), will replace the entity with the actual character.

                6ab17298-8ec0-41a0-b0f4-ab2588455e27-image.png

                Show a screenshot (with View > Show Symbol > Show All Symbols checkmarked) of the shortcuts.xml both before and after your replacement, including the search-and-replace dialog

                since in copying the lines in the xml file it only inserts a linefeed;

                Since you don’t show a screenshot showing newline characters, but I’m pretty sure what you’re referring to is the bug reported here. I have updated the FAQ:

                4a3acaea-49e7-4b8f-86fd-a0fdeae3606d-image.png

                And when I do those replacements, in regular expression mode, in the order specified, then it converts the macros correctly.

                And while I was writing this up, you wrote,

                i had to tick the “regular expressions” option

                Yep, as it told you to do in the FAQ.

                meanwhile in the macro i also have a search for 2 carriage returns and replace it with carriage return - space carriage return and that didn’t work either.

                My new series of three replacements will work correctly for you, to convert the original entities into the right sequence of actual CR and LF characters

                I 1 Reply Last reply Jun 1, 2023, 3:54 PM Reply Quote 0
                • I
                  isaac van den berg @PeterJones
                  last edited by Jun 1, 2023, 3:54 PM

                  @PeterJones peter sorry, our messages passed eachother so i actually anwered datatraveller1’s reply before i saw yours. i don’t (yet) know what you mean with “My new series of three replacements” but i will get to it. meanwhile i stick to the old version for now. thx

                  P 1 Reply Last reply Jun 1, 2023, 4:25 PM Reply Quote 0
                  • P
                    PeterJones @isaac van den berg
                    last edited by Jun 1, 2023, 4:25 PM

                    @isaac-van-den-berg said in macro carriage return = 
 with update v.8.5.3:

                    peter sorry, our messages passed each other so i actually anwered datatraveller1’s reply before i saw yours.

                    I know, I said “and while I was writing this up, you wrote:” to indicate that I knew you’d given additional information.

                    i don’t (yet) know what you mean with “My new series of three replacements” but i will get to it.

                    The updated version of the FAQ includes three replacements instead of two, and I put a screenshot of the relevant portion in my post. Was I really that unclear?

                    P 1 Reply Last reply Jul 5, 2023, 1:41 PM Reply Quote 0
                    • G
                      guy038
                      last edited by guy038 Jun 2, 2023, 12:31 AM Jun 2, 2023, 12:10 AM

                      Hello, @peterjones and All,

                      In the FAQ Desk: v8.5.3 Macros and Run-Menu Commands, you said :

                      FIND WHAT = 
 and REPLACE WITH = \x{000D}\x{000D}\x{000A} with Search mode set to Regular Expression

                      Wouldn’t that be more like :

                      FIND WHAT = 
 and REPLACE WITH = \x{000D}\x{000A} with Search mode set to Regular Expression ??

                      Best Regards,

                      guy038

                      Oh, my bad ! I did not read your note, just after. Sorry for the noise !

                      1 Reply Last reply Reply Quote 0
                      • P
                        PeterJones @PeterJones
                        last edited by Jul 5, 2023, 1:41 PM

                        Good News

                        I have confirmed this morning that the following macro will work with v8.5.2, v8.5.3, and v8.5.4, embedding the CRLF newline in each:

                                <Macro name="Newline 2digit" Ctrl="no" Alt="no" Shift="no" Key="0">
                                    <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;" />
                                    <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0A;" />
                                </Macro>
                        

                        So the two-hex-digit entities work, but the four-hex-digit ones do not. I will shortly be updating the FAQ to match.

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