问题
A certain program's control ClassnameNN was identified by AutoIt Window Information Tool as:
WindowsForms10.BUTTON.app.0.24f4a7c_r27_ad19
in a previous version. In the current version it changed to:
WindowsForms10.BUTTON.app.0.24f4a7c_r13_ad19
(notice the changes after r
).
How to use a regular expression to solve this problem for future versions? Any workaround too is highly appreciable.
回答1:
How to use a regular expression to solve this problem for future versions?
- Documentation - Intro - Controls describes control selection.
- Documentation - Intro - Window Titles and Text (Advanced) provides an example.
Regular expression:
WindowsForms10\.BUTTON\.app\.0\.24f4a7c_r(13|27)_ad19
Visual explanation:

Translates to ClassNN definition as:
[TITLE:My Window; REGEXPCLASSNN:WindowsForms10\.BUTTON\.app\.0\.24f4a7c_r(13|27)_ad19]
Change (13|27)
to (\d*) if any combination of digits should match (as per AutoIt regular expressions).
来源:https://stackoverflow.com/questions/30575886/regex-in-class-name-to-identify-controls