What I mean by the question in the topic title is, can notany() be used anywhere that any() can be used in keyboard code? I’m wondering about this after changing a fairly simple rule where notany was substituted for any and the compilation now gets an error with:
644 - error KM02014: Invalid command or code found in key part of rule
which I am not understanding. Are there any rule contexts where any can be used but not notany ?
The keyboard language &Version string is set to ‘15.0’.
According to notany(), “The notany() statement is only valid in the context part of a rule. It cannot be used with the index() statement, but can be used with the context statement.” Whereas for any(), “This statement is only valid on the left side of a rule; the index() statement is used to match again or output the character matched by the any() statement in the output.”
IIUC this means that notany() can only appear to the left of the “+” in the left side of the rule (that is to the left of the “>”), but any() can appear on either side of the “+” in the left side of the rule (depending on how it is being used).
What is the rule in question (and what are you attempting to accomplish with it)?
With this I wanted to alert the user that they had hit an invalid key and should try again. I otherwise would create a new store with a long list of invalid characters (everything else on the keyboard), which is a little tedious. Is there a standard recipe for this scenario?
Yes. This is somewhat simplified, but at this stage some modification choice must be made. If a non-modifier key is hit, then the beep error signal alerts the user.
Also, in the usage context, the 2nd line with the beep is the last line of a group.