@Ivan-Garnizov said in Macros to find foward the next character:
the question refers to your source of information,
Where do you find and most importantly interpret these codes?
My source of information is the User Manual and the Notepad++ source code, both of which are publically available.
User Manual: Generic info on macros = https://npp-user-manual.org/docs/macros/ User Manual: Details on the macro syntax in the shortcuts.xml file = https://npp-user-manual.org/docs/config-files/#macros Source Code: Values for the message="###" on the type="0" and type="1" commands = https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/include/Scintilla.h Each of those command names (with their numbers) listed in Scintila.h is documented by the Scintilla project = https://scintilla.org/ScintillaDoc.html Source Code: Values for the wParam="###" on the type="2" commands = https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/menuCmdID.h The menuCmdID.h was not intended primarily for human-readability, so here is an example cheat sheet for how to read it: If we wanted to look up the Search > Select and Find Next, and already knew it was IDM_SEARCH_SETANDFINDNEXT:#define IDM_SEARCH_SETANDFINDNEXT (IDM_SEARCH + 48) That says that IDM_SEARCH_SETANDFINDNEXT is defined as the value of IDM_SEARCH + 48. So then you look for IDM_SEARCH:#define IDM_SEARCH (IDM + 3000) So that means that IDM_SEARCH_SETANDFINDNEXT is IDM + 3000 + 48 = IDM + 3048. Looking for the definition of IDM:#define IDM 40000 So that means that IDM_SEARCH_SETANDFINDNEXT is 40000 + 3000 + 48 = 43048 But that required knowing beforehand what the internal IDM_XYZ name for the menu-command was that you wanted was. There are two good ways for finding that: In the menuCmdID.h, it is mostly organized by Notepad++ menu, so it’s not that hard to say “I want the Find (Volatile) Next command from the Search menu”, and then to look in menuCmdID.h for the Search menu entries – they start here at IDM_SEARCH, which isn’t that hard to find (for example, look in the file for SEARCH, which is the name of the menu). Once in the right section, the IDM_<section>_<command_name> is reasonably easy to map to the entries in the default English menu system in Notepad++. But that’s still a bit of effort. I make use of the NppUISpy plugin (installed from Plugins Admin), which allows you to look up what the command ID (and thus wParam="###" value) is for every built-in and currently-installed plugin command is. Once you know the ID, you can use it directly. But you can also look up the IDM_xyz name by looking for the last digit or two, and finding the ones that end in that last digit until the name makes sense for the given menu command. This Forum’s FAQs: Automating Notepad++ = https://community.notepad-plus-plus.org/topic/25400/faq-automating-notepad This has a lot about macros, and how to dig in to find even the right menu command IDs for plugin commands (plugin commands are not recordable, but the FAQ explains how to hack the recorded macro to run plugin commands with certain limitation)@deleelee , there is no published reference of which commands aren’t recordable – there are thousands of commands, and it’s hard to piece together the information(*). The general rule is “any command that requires user input (launches a dialog, renames a file, etc) cannot be recorded or played back; any other built-in command that can be accessed through a menu can at least be played back by a macro, though an arbitrary list of them cannot be recorded even though they can be played back; almost any normal ‘editing’ command, like copy/paste/select etc, which are handled by the scintilla component, should be recordable”. As the Automating Notepad++ FAQ explains, there is no list of which commands are specifically recordable vs not. Essentially, my recommendation is to try to record a macro, and then see if there are any commands (like the Search > Select and Find Next) that don’t end up with a corresponding entry in the macro; those are usually the commands that aren’t macro-recordable. ;-)
(*: when I was writing up the FAQ, I tried to create a list of not-recordable-but-playable based on the source code, but I gave up after a few hours of spinning my wheels on that. It’s not a simple task.)