shortcuts.xml in notepad++
-
I recorded the following Macro:
<Macro name="Compare" Ctrl="no" Alt="no" Shift="no" Key="107"> <Action type="0" message="2024" wParam="6" lParam="0" sParam="" /> <Action type="0" message="2301" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2024" wParam="7" lParam="0" sParam="" /> . . .
Now I would like to edit the Macro, but I don’t know the meaning of the lines.
Could you please help me?
Thank you
Heinz Berecz -
Courtesy of the macro disassembler I’m currently creating:
<Macro name="Compare" Ctrl="no" Alt="no" Shift="no" Key="107"> VK_ADD <Action type="0" message="2024" wParam="6" lParam="0" sParam="" /> SCI_GOTOLINE(6,0) <Action type="0" message="2301" wParam="0" lParam="0" sParam="" /> SCI_LINEDOWNEXTEND(0,0) <Action type="0" message="2024" wParam="7" lParam="0" sParam="" /> SCI_GOTOLINE(7,0)
Based on the commands there, I don’t know that your macro will really do anything except move the caret to user line 8 (system line 7), certainly not a “compare” as the macro line implies.
-
I am going to assume that you actually tried to Macro-record the Plugins > ComparePlus > Compare (or the equivalent on the older Compare Plugin). So that you know for the future, Plugin commands are not macro-recordable, because they don’t have fixed command IDs.
If all you want is to be able to assign a keyboard shortcut to run the Compare action from a plugin, go to Settings > Shortcut Mapper > Plugin commands, and use
Compare
in the Filter field to find the right Compare action, then Modify the shortcut on that line.If you really want Compare to be part of some larger macro, you might be able to sneak your way to it: If you don’t change your list of plugins often, then Compare will be assigned the same commandID every run (until the next time you install a plugin), so you can do the steps:
- Install NppUISpy plugin
- Use that plugin to Spy!, and go into the Plugins hierarchy and see what commandID is assigned to Compare (in mine, it is 22004, but the chances are slim that yours has the same ID). Make note of that number.
Whine at @Alan-Kilborn because he keeps teasing his new script without making it publicKindly remind @Alan-Kilborn that he hasn’t published his script yet, and that having access would make it so much easier for you to figure out your script without pestering him ;-)- Figure out where the Compare command should go in your list of actions
- insert the line below, except use your number from step2 as the
wParam
value:<Action type="2" message="0" wParam="22004" lParam="0" sParam="" />
After saving shortcuts.xml and restarting Notepad++, the Compare action will be part of the macro… but only until the next time you add a plugin, upgrade a plugin, or delete a plugin, at which point you will have to check to see if the ID has changed (and if it has, edit the macro again).
Alternately, if you have the PythonScript plugin, you can write a script that calls
notepad.runPluginCommand("ComparePlus", "Compare")
as part of its sequence, and then follow the PythonScript manual or our PythonScript FAQ to assign a keyboard shortcut to your script. Because that avoids the volatile nature of plugin CommandID values, that would be the route I would take, if I were you.Of course, all this assumes that you really were trying to record the Compare action of a plugin (though I cannot think of any other Compare that you could mean, in the Notepad++ context)
----
Useful Resources
-
@Alan-Kilborn where do I find the macro disassembler?
-
@Heinz-Berecz-0 said in shortcuts.xml in notepad++:
where do I find the macro disassembler?
Currently: nowhere.
It is still a work in progress.Kindly remind Alan that he hasn’t published his script yet, and that having access would make it so much easier for you to figure out your script without pestering him
Feel free to pester; I may or may not comply by disassembling further macros.
Like a good stew, it (the disassembler) isn’t ready until it’s ready. -
@Alan-Kilborn ,
In other words, you’re trying vainly to fool-proof it.
:-)
Abandon all hope, ye who think a better fool can’t be made to counter your efforts.
:-) -
@Lycan-Thrope said in shortcuts.xml in notepad++:
you’re trying vainly to fool-proof it.
No, just trying to find the time, amid other projects, to finish it.
-
@PeterJones said in shortcuts.xml in notepad++:
Whine at @Alan-Kilborn because he keeps teasing his new script without making it publicKindly remind @Alan-Kilborn that he hasn’t published his script yet@Lycan-Thrope said in shortcuts.xml in notepad++:
In other words, you’re trying vainly to fool-proof it.
Could it be that there’s another person on here who’s guilty of letting the “perfect” be the enemy of the “good”? Shocking! 😯
@Alan-Kilborn said in shortcuts.xml in notepad++:
No, just trying to find the time, amid other projects, to finish it.
Send me a copy - I’ll finish it for you (but it’ll be 10Mb when I’m done)! 😁