Forum Discussion
TanyaYatskovska
Alumni
12 years agoHi Jeetendra,
In this case, only the * and ? wildcards can be used. We have a suggestion to add the possibility of using XPath expressions in Windows apps - I've increased its rating based on your request.
Right now, you can do the following:
- obtain the unique parent of the desired object;
- search through all children with the specified type, say text boxes, of the parent object:
textBoxes = parent.FindAllChildren("WndClass", "Edit", 2);
- iterate through all children to find the one that will match your XPath expression:
textBoxes = (new VBArray(textBoxes)).toArray();
if (textBoxes.length > 0)
{
var regEx = /F[a-z].*[0-9]/g;
for (i = 0; i < textBoxes.length; i++)
str = textBoxes.wText;
Matches = str.match(regEx);
if (Matches.length!=0)
desiredObject = textBoxes;
}
Refer to the "FindAllChildren Method" and "Using Regular Expressions in Scripts" articles for more information.
In this case, only the * and ? wildcards can be used. We have a suggestion to add the possibility of using XPath expressions in Windows apps - I've increased its rating based on your request.
Right now, you can do the following:
- obtain the unique parent of the desired object;
- search through all children with the specified type, say text boxes, of the parent object:
textBoxes = parent.FindAllChildren("WndClass", "Edit", 2);
- iterate through all children to find the one that will match your XPath expression:
textBoxes = (new VBArray(textBoxes)).toArray();
if (textBoxes.length > 0)
{
var regEx = /F[a-z].*[0-9]/g;
for (i = 0; i < textBoxes.length; i++)
str = textBoxes.wText;
Matches = str.match(regEx);
if (Matches.length!=0)
desiredObject = textBoxes;
}
Refer to the "FindAllChildren Method" and "Using Regular Expressions in Scripts" articles for more information.