My macro is not recording the selection of text.
-
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 -
@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.
-
@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. :(
-
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?
-
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.- Install NPP UI Spy plugin via Plugins Admin
- Use the UI Spy to see your URL Decode Command ID:
mine is22031
- Exit Notepad++ completely (close all Notepad++ instances). Restart Notepad++
- 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 - Save. Exit Notepad++ completely. Reload Notepad++.
- 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
edit: If you ever install a new plugin, that command ID may change, and you may have to update your macro
-
@PeterJones Peter I appreciate the reply and I did as you instructed but it’s still not working. Here is what I have found:
-
the command ID for the plugin in question is 22011.
-
Closed Notepad++ application
-
Located the shortcuts.xml file in my user profile and modified it accordingly. (Or maybe I’ve screwed up somewhere?!
-
-
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:
And, for good measure, show Macro menu, too… just to prove that UrlEncodeAll macro is really seen.
-
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.
-
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.
-
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.
-
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.
-
@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.