Method wnd.runAndFind
Overload
Opens and finds new window. Ignores old windows. Activates.
public static wnd runAndFind(Action run, Seconds timeout, string name = null, string cn = null, WOwner of = default, WFlags flags = 0, Func<wnd, bool> also = null, WContains contains = default, bool activate = true)
Parameters
run (Action)
Callback function. Should open the window. See example. |
timeout (Seconds)
How long to wait for the window. Seconds. Can be 0 (infinite), >0 (exception on timeout) or <0 (no exception). More info: Wait timeout. |
name (string)
Window name. Usually it is the title bar text.
String format: wildcard expression.
|
cn (string)
Window class name.
String format: wildcard expression.
|
of (WOwner)
Owner window, program or thread. Depends on argument type:
See wnd.getwnd.Owner, wnd.ProcessId, process.thisProcessId, wnd.ThreadId, process.thisThreadId. |
flags (WFlags) |
also (Func<wnd, bool>)
Callback function. Called for each matching window.
It can evaluate more properties of the window and return |
contains (WContains)
Defines an object that must be in the client area of the window:
|
activate (bool)
Activate the window. Default: |
Returns
wnd
Window handle as wnd. On timeout returns |
Exceptions
TimeoutException
timeout time has expired (if > 0). |
AuWndException
Failed to activate. |
ArgumentException
|
Remarks
This function isn't the same as just two statements run.it and wnd.find. It never returns a window that already existed before calling it.
Examples
var w = wnd.runAndFind(
() => run.it(folders.Windows + @"explorer.exe"),
10, cn: "CabinetWClass");
print.it(w);