Community
    • Login

    HELP: Having trouble with Macros in v8.5.3 or later

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    28 Posts 9 Posters 5.7k 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 @guy038
      last edited by Alan Kilborn

      @guy038 said in HELP: Having trouble with Macros in v8.5.3 or later:

      Note the contents of the macros Test_CRLF , Test_LF

      I can duplicate your poor results with these two. :-(

      if we should trigger an GitHub issue for these oddities ??

      Either that, or post about it in the 8.5.3 release thread, HERE.

      1 Reply Last reply Reply Quote 1
      • guy038G guy038 referenced this topic on
      • Massimo PiscopoM
        Massimo Piscopo @PeterJones
        last edited by

        I’ve a similar problem.
        I’ve created a macro doing a lot of things, included changing “word” into ‘word’ (look for ‘ ’ instead of " ").
        This worked ok until last update (8.5.3, build May 15 2023 06:07:16).
        Now the macro (I don’have touched it) change “word” into

        & # x 2 0 1 8 ; w o r d & # x 2 0 1 8 ;

        Please ignore spaces: if I don’t insert spaces, this forum convert “& # x 2 0 1 8 ; w o r d & # x 2 0 1 8 ;” into " ‘word’ " and it’s impossible to understand what I mean.
        I need Notepad++ don’t “convert” the ‘ ’ symbols.

        I’ve tried to search my macro recorded but I don’t find it in shortcuts.xml. Where I can find it? My macro is called “calcio (prime correzioni)” but in shortcuts.xml I find only “Trim Trailing Space and Save”. BTW the date of shortcuts.xml is from 2021 and maybe my macro was created after.

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

          Hello, @massimo-piscopo and All,

          I suppose that you have a standard installation with N++ installer ! Then, you must look for the real location of your shortcuts.xml file !


          Follow the steps, below :

          • Open your Notepad++ v8.5.3, as usual

          • Click on the Windows Logo key and, simultaneously, hit the R key

          • In the Execute window, type in Explorer.exe and hit the Enter key

          => The File Explorer program should start

          • Clic on the ‘STAR’ and type in the string %appdata%\Notepad++

          • Valid with the Enter key

          => You should normally see a shortcuts.xml file, along with some others files

          • Clic on the shortcuts.xml file and drag this file into your notepad++ window

          => You should see, in the <Macros> section, your macro named calcio (prime correczioni)

          • Now, open the Replace dialog ( Ctrl + H )

          • Untick all box options

          • SEARCH &#x2018;

          • REPLACE \x{2018}

          • Check the wrap around option

          • Select the Regular expression search mode ( IMPORTANT )

          • Click on the Replace All button

          • Save the changes of your shortcuts.xml file

          • Close Notepad++

          • Restart Notepad++

          => Your macro should be OK and do what it is designed for :-)

          Best Regards,

          guy038

          1 Reply Last reply Reply Quote 2
          • PeterJonesP
            PeterJones @Massimo Piscopo
            last edited by

            @Massimo-Piscopo ,

            I don’t find it in shortcuts.xml

            It’s there, or your macro doesn’t exist when you exit Notepad++ and restart. Did you look in the right shortcuts.xml?

            If you had read the first post in this discussion, you would have seen the we asked you to supply your ?-menu’s Debug Info. Because you chose not to do so, we have to assume the location of your shortcuts.xml is in %AppData%\Notepad++\shortcuts.xml, as @guy038 guessed while I was typing this.

            Massimo PiscopoM 1 Reply Last reply Reply Quote 3
            • Massimo PiscopoM
              Massimo Piscopo @PeterJones
              last edited by

              @guy038 and @PeterJones THANK YOU SO MUCH, I’ve solved. <3

              1 Reply Last reply Reply Quote 1
              • wonkawillyW
                wonkawilly @datatraveller1
                last edited by

                @datatraveller1 said in HELP: Having trouble with Macros in v8.5.3 or later:

                @wonkawilly As far as I have understood @guy038 and the FAQ, you simply have to replace the old values UTF-8 encoded literally with è, à etc.

                I’m not sure if something like Python would work for the macro system but I partly agree that it is a bit ugly sometimes - In my case I don’t like that real line breaks get inserted into shortcuts.xml.

                It should be good enough to see it replaced with “\r\n” as in regular expression syntax. Nevertheless, that solution would of course be good just to “survive”, not in the long run, because nevertheless the optimus would be to have a complete new macro system as in LibreOffice, MsOffice and so on. It would be a huge improvement even replacing the current macro system in npp with a new macro system based on AutoIt language and macro recorder.
                The current macro system is too cryptic and too limited. Compare this row
                <Action type=“1” message=“2170” wParam=“0” lParam=“0” sParam=“è” />
                with its equivalent in a simple scripting language in which you can even do loops or if/else and so much more.
                IMHO the current macro system in N++ is going old… and really needs retirement, better sooner than later…
                Also another ugly thing is that n++ saves new recorded macros only on exit: it would be better to save new created macros on click on the Save Macro button so they could be edited without the need of restarting npp: other ugly and incomprehensible thing.

                1 Reply Last reply Reply Quote 1
                • Cement KnightC
                  Cement Knight
                  last edited by

                  Moving to the next bookmark does not work inside a macro. No matter where the cursor is, it will always go to a specific bookmark.

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

                    @Cement-Knight said in HELP: Having trouble with Macros in v8.5.3 or later:

                    Moving to the next bookmark does not work inside a macro. No matter where the cursor is, it will always go to a specific bookmark.

                    You might want to start a new thread with that, as it is very unrelated to previous conversation in this thread.

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

                      Good News

                      It turns out that XML’s five predefined named-entities still work even in Notepad++ v8.5.3 and newer. Also, the entities made up of two hex digits still work.

                      The following macro shows the named entities that still work in macro sParam values with v8.5.3 and newer, as well as showing how to get a CRLF newline sequence using the two-hex-digit entities. You can use this as an example for when you are manually editing your macros to work for v8.5.3 and newer:

                              <Macro name="XML Named Entities" Ctrl="no" Alt="no" Shift="no" Key="0">
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&amp;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&lt;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&gt;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&apos;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&quot;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0A;" />
                              </Macro>
                      

                      And here are all the two-digit hex entities for ASCII characters from 1 to 127:

                              <Macro name="ASCII 2-digit Hex Entities" Ctrl="no" Alt="no" Shift="no" Key="0">
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x01;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x02;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x03;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x04;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x05;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x06;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x07;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x08;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x09;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0a;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0b;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0c;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0d;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0e;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0f;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0A;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x10;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x11;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x12;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x13;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x14;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x15;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x16;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x17;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x18;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x19;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x1a;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x1b;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x1c;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x1d;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x1e;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x1f;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0A;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x20;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x21;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x22;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x23;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x24;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x25;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x26;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x27;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x28;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x29;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x2a;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x2b;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x2c;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x2d;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x2e;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x2f;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0A;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x30;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x31;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x32;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x33;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x34;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x35;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x36;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x37;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x38;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x39;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x3a;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x3b;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x3c;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x3d;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x3e;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x3f;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0A;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x40;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x41;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x42;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x43;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x44;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x45;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x46;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x47;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x48;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x49;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x4a;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x4b;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x4c;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x4d;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x4e;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x4f;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0A;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x50;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x51;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x52;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x53;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x54;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x55;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x56;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x57;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x58;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x59;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x5a;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x5b;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x5c;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x5d;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x5e;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x5f;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0A;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x60;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x61;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x62;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x63;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x64;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x65;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x66;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x67;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x68;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x69;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x6a;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x6b;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x6c;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x6d;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x6e;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x6f;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0A;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x70;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x71;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x72;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x73;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x74;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x75;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x76;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x77;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x78;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x79;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x7a;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x7b;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x7c;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x7d;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x7e;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x7f;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;" />
                                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0A;" />
                              </Macro>
                      

                      The FAQ has been updated to match this new information.

                      1 Reply Last reply Reply Quote 5
                      • Mike NewmanM
                        Mike Newman
                        last edited by PeterJones

                        Moderator Note: The contents of this post were moved to a separate topic, Macro works normally, but fails when shortcut is Ctrl+Shift+C, because it’s actually separate from the >=v8.5.3 issue for this Topic.

                        Alan KilbornA 1 Reply Last reply Reply Quote 1
                        • PeterJonesP PeterJones locked this topic on
                        • PeterJonesP PeterJones unlocked this topic on
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors