FindTopWindows

IList<Control> FindTopWindows(string wantedText);

IList<Control> FindTopWindows(string wantedText, TextMatch textMatch);

IList<Control> FindTopWindows(string wantedText, string wantedClass);

IList<Control> FindTopWindows(string wantedText, string wantedClass, TextMatch textMatch);

IList<Control> FindTopWindows(Predicate<Control> selectionFunction);

Parameters

wantedText: The text caption of the Control.  The default match criteria is contains, case insensitive. This value can be none or an empty string "" if you are only matching on wantedClass.

textMatch: Options are TextMatch.Contains (default), TextMatch.Exact, TextMatch.StartsWith, TextMatch.EndsWith, TextMatch.MatchCase See TextMatch.

wantedClass: The window class name.

selectionFunction: A reference to a user supplied selection function. See SelectionFunction.

Return Value

A list of Control objects that can be used to access the found windows.

Remarks

This method is similar to FindTopWindow, but is used where there may be multiple windows matching the selection criteria.

The window can be matched on caption, a caption and a class name, or a custom selection function. If no matching windows are found, an empty list is returned. There is no time delay on this method.

Example

IList<Control> windows = FindTopWindows(none, "className"); // return all top level windows with the class "className"

IList<Control> windows = FindTopWindows("Microsoft Word", TextMatch.EndsWith); // find all windows with caption ending with "Microsoft Word"

 

WriteMessage("num windows=" + windows.Count.ToString());

if (windows.count < 1)

{

Error("Insufficient windows found");

ExitVU();

}

else

{

for (int i=0; i<windows.count, i++)

{

WriteMessage("Caption=" + windows[i].GetText());

}

}

Control window = FindTopWindows(none, "className")[0]; // get first window of this class - Note will raise and exception if no windows found.

Related:

 

This topic was last updated on June 21, 2019, at 02:49:50 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2020 Eggplant