Forum Discussion
nicktulett
13 years agoContributor
Something like
function findUnion(baseComponent, Props, Values, depth) {
var unionValues = Values.pop().split("|"), unionValue, u = 0, founds = [],
foundCheck = {}, found, f = 0, result = [];
while (unionValue = unionValues[u++]) {
founds = founds.concat((new VBArray(baseComponent.FindAll(Props, Values.concat(unionValue), depth, true))).toArray());
}
while (found = founds[f++]) {
if (!foundCheck[found.FullName]) {
foundCheck[found.FullName] = true;
result.push(found);
}
}
return result;
}
//usage:
findUnion(AUT.MainWindow.OpenTab.Composite.Composite.Composite.PropertiesComposite,
["VisibleOnScreen", "WndClass"],
[true, "Static|Edit"], 10
);
Note that I had to use FindAll rather than FindAllChildren. If a call to FAC returns nothing, then subsequent call also come up empty even if the child objects are there (TC 8.60)
function findUnion(baseComponent, Props, Values, depth) {
var unionValues = Values.pop().split("|"), unionValue, u = 0, founds = [],
foundCheck = {}, found, f = 0, result = [];
while (unionValue = unionValues[u++]) {
founds = founds.concat((new VBArray(baseComponent.FindAll(Props, Values.concat(unionValue), depth, true))).toArray());
}
while (found = founds[f++]) {
if (!foundCheck[found.FullName]) {
foundCheck[found.FullName] = true;
result.push(found);
}
}
return result;
}
//usage:
findUnion(AUT.MainWindow.OpenTab.Composite.Composite.Composite.PropertiesComposite,
["VisibleOnScreen", "WndClass"],
[true, "Static|Edit"], 10
);
Note that I had to use FindAll rather than FindAllChildren. If a call to FAC returns nothing, then subsequent call also come up empty even if the child objects are there (TC 8.60)