Forum Discussion
TanyaYatskovska
Alumni
13 years agoHi Tanvi,
Even if the FindChild method returns the first found object matching the search criteria, you'd better check whether the object is found in the object tree indeed via the Exists property. For example:
function Test()
{
var PropArray, ValuesArray, p, w;
// Creates arrays of property names and values
PropArray = new Array("WndCaption", "Visible");
ValuesArray = new Array("Font st&yle:", true);
// Searches for the window
p = Sys.Process("Notepad");
w = p.FindChild(PropArray, ValuesArray, 5);
// Processes the search results
if (w.Exists)
Log.Message(w.FullName);
else
Log.Error("The object was not found.");
}