Regex in class name to identify controls

笑着哭i 提交于 2019-12-02 01:42:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!