UIClick with only partial element name

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
Warren
Pro Scripter
Posts: 83
Joined: Sun Oct 08, 2017 11:57 pm

UIClick with only partial element name

Post by Warren » Thu Oct 19, 2017 10:59 pm

Same issue with a number of UI element commands, but taking UIClick as an example, second variable passed is the name of the element... but there are many times when I can only know ahead of time a partial element name. For instance, I know there will be an element containing a certain word, but that will not be the entire name, and it keeps changing.

I get the concept of maybe getting the UIAccessibileList, looking for that piece of the string, and getting the rest of the element name, but I'm not really sure how to isolate that particular element's name vs the rest of the enormous string that returns from UIAccessibleList since I don't know where it will be on the list, or how long it will be.

Or, is there a much simpler way? I can't seem to get any variation on wildcards to work directly with UIClick or similar commands in order to just pass the partial element name.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: UIClick with only partial element name

Post by Marcus Tettmar » Fri Oct 20, 2017 11:48 am

If you are parsing UIAccessibleList surely the element name will match between start of line and = sign. So e.g. let's say you have several "Panel" objects but you don't know what they could be called - they may be Panel1, Panel2, etc you could do:

UIAccessibleList>Macro Scheduler 14,list
RegEx>(?m)(?<=^)*Panel.*?(?=\=),list,0,matches,nm,0

This would return an array of all element names that have the word "Panel" in them. If you want the value as well then change the expression to end at the end of the line instead of the equals sign.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts