Community
    • Login

    My macro is not recording the selection of text.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    12 Posts 4 Posters 1.6k 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.
    • JustinJudoJ
      JustinJudo
      last edited by PeterJones

      I have several URLs in a single text file that look like this:

      https://crapwebsite.com/?blah blah blah...random series of letters & numbersu2=https%3A%2F%2Fwww.ebay.com%2Fitm%2FASICS-Mens-Hypergel-Yu-Running-Shoes-1021A065%2F114495561241

      I recorded a very simple macro but it’s not recording the very 1st step where I select all of the text.
      Step 1: Ctrl + A (in order to select all the text)
      Step 2: Plugins menu > MIME tools > URL decode
      Step 3: do some more stuff with the URL string.

      I have no problems with Step 2 & 3. How can I get Notepad++ to record my first step? For some reason it’s not recording the selection of text procedure.

      —

      moderator added code markdown around text; please don’t forget to use the </> button to mark example text as “code” so that characters don’t get changed by the forum

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

        @JustinJudo said in My macro is not recording the selection of text.:

        Step 1: Ctrl + A (in order to select all the text)

        That records into a macro just fine for me in Notepad++ 7.9.1.

        JustinJudoJ 1 Reply Last reply Reply Quote 1
        • JustinJudoJ
          JustinJudo @Alan Kilborn
          last edited by

          @Alan-Kilborn You’re right Alan. After reading your comment, I decided to create a test macro that only contains 1 step only. Ctrl + A to select all of the text in the file. It works just fine. I can see all of the text has been selected. So now this begs the question, what the hell is going on with Notepad++ between steps 1 & 2? This is very odd. I ran my original macro again - it doesn’t do a single darn thing. :(

          JustinJudoJ PeterJonesP 2 Replies Last reply Reply Quote 0
          • JustinJudoJ
            JustinJudo @JustinJudo
            last edited by JustinJudo

            OK after some troubleshooting, now I see the real issue here is that the macro utility does not record any user actions taken though the ‘Plugins’ menu:

            Plugins > MIME tools > URL decode.

            Any idea on how I can get Notepad++ to record step 2?

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

              @JustinJudo ,

              It’s actualy the Plugins > MIME Tools > URL Decode that isn’t recording. You can see this by exiting and re-loading Notepad++, then opening %AppData%\Notepad++\shortcuts.xml and looking for whatever you named your macro.

              This is because it’s a plugin entry, with a non-fixed menuCommandID, so the macro-recorder doesn’t record that action, since if you install a new plugin, the next time Notepad++ runs, the URL Decode action might have a different ID.

              If you know what your URL Decode ID is, you can manually edit the shortcuts.xml to include that action.

              1. Install NPP UI Spy plugin via Plugins Admin
              2. Use the UI Spy to see your URL Decode Command ID:
                0641d4d3-64d6-4178-97ee-ab8b7acba1ea-image.png
                mine is 22031
              3. Exit Notepad++ completely (close all Notepad++ instances). Restart Notepad++
              4. In %AppData%\Notepad++\shortcuts.xml, add <Action type="2" message="0" wParam="22031" lParam="0" sParam="" /> – but use whatever ID your URL Decode uses right now
              5. Save. Exit Notepad++ completely. Reload Notepad++.
              6. Now your macro should do both. You can look at %AppData%\Notepad++\shortcuts.xml to see the command is still there. For me, I have 0c950f20-2807-4987-b7d2-920aa1b65faa-image.png

              edit: If you ever install a new plugin, that command ID may change, and you may have to update your macro

              JustinJudoJ 1 Reply Last reply Reply Quote 2
              • JustinJudoJ
                JustinJudo @PeterJones
                last edited by JustinJudo

                @PeterJones Peter I appreciate the reply and I did as you instructed but it’s still not working. Here is what I have found:

                1. the command ID for the plugin in question is 22011.
                  URL decode command ID.png

                2. Closed Notepad++ application

                3. Located the shortcuts.xml file in my user profile and modified it accordingly. (Or maybe I’ve screwed up somewhere?!
                  shortcut file modified.png

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

                  @JustinJudo ,

                  Your filename ends in .txt. Notepad++ won’t recognize that as a config file. Did you just do that temporarily to open with MS Notepad?

                  Becase the macro I posted worked for me. It took URL-encoded text, selected all, and replaced it with the decoded version.

                  I suggest you try to edit %AppData%\Notepad++\shortcuts.xml, and add in exactly the macro I showed, except with your wParam value. After you save the config file in the right location with the right name, you need to exit all copies of Notepad++ and then reload Notepad++ for the change to take effect.

                  If it’s still not working, do a screenshot within Notepad++, showing the right shortcuts.xml open with the macro shown, and showing ?-menu’s Debug Info, like:
                  07c3078c-7531-4897-bf84-a46d520469f2-image.png
                  And, for good measure, show Macro menu, too… just to prove that UrlEncodeAll macro is really seen.
                  0fc368c6-4c1f-41fe-9cc0-985b1840b558-image.png

                  JustinJudoJ 1 Reply Last reply Reply Quote 2
                  • JustinJudoJ
                    JustinJudo @PeterJones
                    last edited by JustinJudo

                    @JustinJudo ,

                    Your filename ends in .txt. Notepad++ won’t recognize that as a config file. Did you just do that temporarily to open with MS Notepad?

                    Yes I did, but I changed the file extension back to the original xml extension after editing the file accordingly.

                    I suggest you try to edit %AppData%\Notepad++\shortcuts.xml, and add in exactly the macro I showed, except with your wParam value.

                    I’ll try that and report back. Thanks.

                    1 Reply Last reply Reply Quote 0
                    • JustinJudoJ
                      JustinJudo
                      last edited by

                      Ah! finally figured out the problem. Through some trial & error I figured out that I had inadvertently deleted a much needed line in my original macro and it was causing all the issues I had. Luckily I had made a backup copy of my shortcuts.xml file onto another drive.

                      Started over and followed your instructions for yet a 3rd time. As the old saying goes, 3rd times is the charm.

                      I appreciate the help on this Peter. I’m all set now.

                      1 Reply Last reply Reply Quote 1
                      • JustinJudoJ
                        JustinJudo
                        last edited by

                        I’m updating this post with the screenshot of the correctly modified shortcuts.xml file in case someone does a search on this issue in the future. This way he or she will have a reference for how to do this correctly without wasting too much time.

                        shortcut file modified CORRECT version.png

                        1 Reply Last reply Reply Quote 2
                        • Stephen RiegerS
                          Stephen Rieger
                          last edited by Stephen Rieger

                          This issue is quite painful.

                          The latest update to Notepad++ to 8.1.2 changed the ‘Command ID’ for this Plugins > MIME Tools > URL Decode for me from 22011 to 22027. It would be nice if some consistency could be maintained through updates such that macros don’t need to be edited.

                          One saving point is that the change is consistent across multiple computers with the same updated version so I only need to use UI Spy on one machine so I can still maintain one consistent copy for multiple users.

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

                            @Stephen-Rieger said in My macro is not recording the selection of text.:

                            changed the ‘Command ID’ for this Plugins > MIME Tools > URL Decode for me from 22011 to 22027.

                            Plugins have always been dynamically assigned their command ID numbers – it goes sequentially starting at 22000 and assigning them based on the order of the menu entries for each plugin, where each plugin is processed alphabetically (by DLL name, IIRC).

                            Any time you change your plugin list – whether it’s because you add or remove a plugin, or if you upgrade to a new Notepad++ version and that changes the number of entries in one of the default plugins or you accidentally forget to install a plugin or you decide you want an extra plugin or if the new version of Notepad++ tells you about an update on one of your plugins so you update that plugin and it has more menu entries – any time any of those changes occur, the command ID for that plugin menu entry will change. This has been true for the entire time I have used Notepad++ over the last decade or more.

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