Microsoft OneNote is stupid in a number of ways, one of which is not having unique names for multiple windows with same notebook:
In a KM macro, I have a test to ensure that my "og_hmcpsych" notebook is the active window before proceeding: it checks for a "marked" menu item that begins with "og_hmcpsych"...
This works if there's only ONE such item, but fails if there is more than one. KM seems to be finding the 1st instance and, seeing that it's not "marked," returning "false"...That makes sense for efficiency but not if there could be multiple menu items with the same name
verify in notebook: Pt .kmmacros (5.0 KB)
Request that the test for menu item being "marked" not fail if there is ANY matching item that is marked (regardless of whether there is ANOTHER that is not).
I understand what you mean, but that is not how it works.
The condition is not:
"A menu with name matching WHATEVER is marked"
"The menu with name matching WHATEVER" has some state (which could be enabled/disabled/marked/not marked/etc).
So it is not just a question of efficiency, it changes the meaning of the condition to one that handles unsupported cases.
What would it mean, for example, if it is:
menu with name match WHATEVER
is not marked
Is that going to be always true when there are two matching entries? Or always false?
If “is marked” goes off looking for other menu items, and finds the one that is, then should “is not marked” do the same, finding whichever one isn't, or should it always be the reverse of the first one, or what?
So I'm afraid in this case, you're out of luck. You may be able to find another solution, but the condition is unlikely to change to match what you want it to do.