How to find a form by name with a wildcard?

Ask general questions here.
User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

How to find a form by name with a wildcard?

Post by Ciege » Fri Feb 27, 2009 10:37 pm

To find a form by name I use

Code: Select all

Ranorex.Form HDForm = Host.Local.FindChild<Ranorex.Form>(WindowName);
Let’s say that a window I am looking for always has "123" in the title and a date/time stamp. I want to look for the window with a name of "123*".

How can I manipulate the code above to do that?

Thanks...

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Mon Mar 02, 2009 1:49 pm

You can use regular expressions in RanorexPaths. Please, read the documentation for more info:
http://www.ranorex.com/support/user-gui ... html#c1791

In your example (a form which title starts with "123") the code should look like this:

Code: Select all

Ranorex.Form HDForm = Host.Local.FindSingle<Ranorex.Form>("form[@title~'^123.*']");
Regards,
Alex
Ranorex Support Team