When writing your own keyword, is there a way to limit input to an attribute to certain set/group?
Is there a way how to check these before doing anything else with those values after?
Keyword1 with 1 argument :
Let´s say, in that argument I wanna allow only integers 1 to 4, anything greater than that should not be accepted.
Keyword 2 with 1 argument:
Let´s say, I want a number, not longer than 6 digits (1 to 5 digits is fine)
Thought you still would have to validate the parameter inside the keyword.
Not sure if that works nicely. If it does, it might be worthwhile enhancing robot by adding the option to add an argument validator to keywords. Then parameters would be validated automatically.
I usually do it the way @Endo showed. But for keyword implemented in python there is an alternative using the Argument conversion feature.
pekkaklarck mentioned it in the video presentation of RF7(at 27:40 to 33:30), but I have not tried it yet.
Apparently, type hint in python implemented keywords are not just type hints for documentation, but actually generate a failure (in some case only?).
Since RF7.0 “literals” are supported, but on earlier versions it was already possible using Enum or IntEnum. The new Literal feature has less boilerplate, as you don’t have to define an enum class beforehand.
I have not played with it yet, but this is what I understand from the video. I will be sure to try it someday though! Thanks for the reminder!
Thank you, @FrancisG and @Noordsestern, I have to have a better look at those as this is the first time I heard about them, I will try the Argument conversion first.