strange behavior with macro
-
@Alan-Kilborn So then the question arises: how in the world did you know that the topic starter missed wParam = “43061” in her/his macro?
-
@Paul-Wormer said in strange behavior with macro:
how in the world did you know that the topic starter missed wParam = “43061” in her/his macro?
Well, when the OP said:
i think the issue is when paste copy marked text into new file.
…that was a big clue. :-)
So I went looking for specifically something related to that in a really short macro – it wasn’t hard to pinpoint the difficulty.And… the Copy Marked Text button is kind of an oddball in the Mark window, when you think about how the searching macros are encoded – it isn’t related to searching, but is rather something you do after searching.
It is on my TODO list to file a bug report about this, since it has confused at least one user so far. There’s a workaround (as I pointed out), but it is still confusing.
-
@Paul-Wormer said,
I’ve searched in vain the context-help documents and the Npp user manual for a description of the wParam = 43061
I did not succeed in finding a description of the search method that copies a marked string to the clipboard.And @Alan-Kilborn replied,
This is because what you are seeking to find does not exist.
It takes a little reading of the manual, and some intuition; there isn’t a nice simple name-to-description map, but the information is available. The user manual Macros section describes, in general, what the wParam is used for, and where to find details on the individual message:
Firstly, looking in menuCmdId.h , the name of the file gives a really big hint that each of the
IDM
constants corresponds to a Notepad++ menu entry … but it does take some intuition.Secondly, it also directs you to
localization\English.xml
, where it says to look for those numbers. If you were to find a number like43061
in that file, you would find one entry just labeled “Find Mark Style” in the “all menu item” <Commands> section (which would be confusing, because there are a series of entries near each other which all have that same name), but then the second instance of43061
in the <ShortcutMapper><MainCommandNames> is the more clear “Copy Styled Text of Find Mark style”.However, I will add a “TODO” to try to make it more clear that the Type-2 macro entries all correspond to an entry in Notepad++'s menu system.
-
@PeterJones I don’t have
localization\English.xml
, but I do haveC:\Users[..]\AppData\Roaming\Notepad++\nativeLang.xml
in which I found:<Item id="43061" name="Find Mark Style"/>
It takes lots of intuition and years of experience to associate this name with
SEARCH_MARKEDTOCLIP
.In any case, thank you for pointing me to this file.
-
@Paul-Wormer said in strange behavior with macro:
I don’t have localization\English.xml, but I do have C:\Users[…]\AppData\Roaming\Notepad++\nativeLang.xml
Just a guess, but I’d suppose when using an installed version of Notepad++ (which I do not do), that english.xml would be under a localization folder under the folder in which the notepad++.exe file lives?
-
@Paul-Wormer said in strange behavior with macro:
@PeterJones I don’t have
localization\English.xml
,Yes you do.
c:\program files\notepad++\localization\english.xml
, or wherever else your Notepad++ is installed – unless you didn’t install the English language localization when you did your installation (in which case, look in whichever language you do use). See Config Files Location in the manual. That’s wherenativeLang,xml
comes from (when you select your localization). But yes,nativeLang.xml
contains the same information, so if you cannot seem to findenglish.xml
, then use that instead.but I do have
C:\Users[..]\AppData\Roaming\Notepad++\nativeLang.xml
in which I found:<Item id="43061" name="Find Mark Style"/>
Umm. Did you not notice I said specifically,
you would find one entry just labeled “Find Mark Style” in the “all menu item” <Commands> section (which would be confusing, because there are a series of entries near each other which all have that same name), but then the second instance of 43061 in the <ShortcutMapper><MainCommandNames> is the more clear “Copy Styled Text of Find Mark style”.
I rather thought I covered that confusion with that sentence.
It takes lots of intuition and years of experience to associate this name with
SEARCH_MARKEDTOCLIP
.That’s why I told you to keep searching for the second instance, which is a more helpful name.
And you seem to have not understood my explanation. If you know the ID already (ie, reading an existing macro), you can easily figure out which menu entry it maps to by searching for that number in the english.xml (or equivalent). On the other hand, if you want to figure out the number for a given menu entry, look at the name of the menu entry, then look for that text in the english.xml (or equivalent), and see the id it is associated with. Once you have that number, then you can figure out the number from menuCmdId.h if you really want to (but you don’t need to – because you already know which command ID which goes to the menu entry you are interested in).
-
@Alan-Kilborn Yes indeed, I have
English.xml
underC:\Program Files\Notepad++\localization
. So, which of the two files takes precedence? Isn’t having two files a bit superfluous and therefore error prone? -
So, which of the two files takes precedence? Isn’t having two files a bit superfluous and therefore error prone?
-
@Paul-Wormer said in strange behavior with macro:
So, which of the two files takes precedence?
Typically, the stuff in “appdata” is what Notepad++ is using specifically for YOU. And when a localization file is put there by the program, it calls it nativeLang.xml.
If you’re using English, all of the others (French, Spanish, etc.) are choices you could make in the future, so until you do, the “sources” for these are left with the main program files, with their original names.
-
@PeterJones Yes, I take that back. I understood perfectly well your explanation that
43061
is the key in going fromFind Mark Style
toIDM_SEARCH_MARKEDTOCLIP
. But it takes intuition to realize that both names mean nothing more than: copy marked text to the clipboard. As Alan pointed out there is noFind
involved. The Npp search popup adds to the confusion by speaking aboutStyled Text
. I had no idea that styled text is the same as marked text, because I never looked into the text styling possibilities of N++. -
@Paul-Wormer said in strange behavior with macro:
the key in going from “Find Mark Style” to IDM_SEARCH_MARKEDTOCLIP
This may be the key part of Peter’s earlier reply for you:
but then the second instance of 43061 in the <ShortcutMapper><MainCommandNames> is the more clear “Copy Styled Text of Find Mark style”.
“Find Mark Style” is the bottom-level submenu text for the command. It may not convey full meaning until you combine it with the upper part, which is what “MainCommandNames” tries to do:
But it takes intuition to realize that both names mean nothing more than: copy marked text to the clipboard
I think my current answer explains it?
-
@Alan-Kilborn said in strange behavior with macro:
“Copy Styled Text of Find Mark style”
You really feel that “Copy Styled Text of Find Mark style” is clear? Talking about intuition …
-
@Paul-Wormer said in strange behavior with macro:
You really feel that “Copy Styled Text of Find Mark style” is clear?
Actually, I don’t find it poor. :-)
YMMV.It actually sounds exactly like something the Notepad++ author (a non-native English speaker) would come up with. :-)
-
The author of the program is not a native english speaker, and some of the legacy phrasings are not always the natural english phraseology. And sometimes it is hard to convey the full meaning in a brief piece of text that’s really just meant as an indicator in the Shortcut Mapper.
Honestly, I would have preferred if the localization XML files had been organized in a
<TopMenu menuId="search"><SubMenu menuId="Copy Styled Text"><Item id="43061" name="Find Mark Style"></SubMenu></TopMenu>
format, because that would have made it easier for translators and users to find specific menu entries to translate. But at this late stage, after many years of using the existing format for the XML file, I highly doubt the developer would choose to completely redesign that config file, since it would also require changing the XML processing, and cause compatibility errors that would dwarf the confusion caused by the v7.9.1-conversion of the FunctionList definitions.Macros for normal users are meant to be something that they record and run, that they never have to think about the implementation details or the syntax. And they “just work”, most of the time.
But if for those who want to dig into the nitty-gritty, the manual provides some guidance, but at some point, digging into the details is meant for Power Users, and Power Users are expected to have developed some intuition about the way the program works, and how to navigate through the various config files and menu systems and establish those mental mappings. And nothing but repeated readings of the manuals and tutorials that exist, navigating through the config files, and experimenting to figure things out will help you build that intuition. If you are not yet at that Power User level, that’s fine… but then you cannot expect to understand Power User details until you invest the effort. You can feel free to ask questions, and we will do our best to answer; but no answer we give nor phrasing of the user manual will ever turn you into an immediate Power User.
----
Addendum: I do grant that one can be a Power User in one area of the application, and not in another, and some are easier to gain Power User status in than others. Macros may be one of the more complicated. You have often given great advice to other users, which I have appreciated and upvoted. However, in this instance, you may have to invest more time into exploring Macro syntax, and experimenting with going through the various steps I showed above, in order to gain Power User status on the Macros feature. -
@PeterJones Well, this discussion makes it perfectly clear that I am not a “Power User” . It is a status I do not necessarily strive for. But this doesn’t mean that I don’t want to understand some of the topics that are discussed on this forum. As you rightly point out, this isn’t easy, the navigation through the Scintilla and Npp docs, reading your extensive user manual, all the possible settings etc., a non-Power-User experiences it as a jungle. Just like a real jungle all this has grown over the years, and not always in a clean, logical direction, I understand that.
-
I opened an official issue about the original topic of this thread: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13405
-
@Alan-Kilborn said in strange behavior with macro:
I opened an official issue about the original topic of this thread: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13405
This issue has been fixed and will appear in the next version of Notepad++, presumably that will be 8.5.2.
-
yes confirmed. fixed in 8.5.2 version (at point 9)
https://community.notepad-plus-plus.org/topic/24345/notepad-v8-5-2-release