Show / Hide Table of Contents

Property WindowTriggers.this(+ 1 overload)


Overload

Adds a window trigger and its action.

public Action<WindowTriggerArgs> this[TWEvent winEvent, string name = null, string cn = null, WOwner of = default, Func<wnd, bool> also = null, WContains contains = default, TWFlags flags = 0, TWLater later = 0, string f_ = null, int l_ = 0] { set; }
Parameters
winEvent  (TWEvent)

Trigger event.

name  (string)

Window name. Usually it is the title bar text. String format: wildcard expression. null means "can be any". "" means "no name".

cn  (string)

Window class name. String format: wildcard expression. null means "can be any". Cannot be "".

of  (WOwner)

Owner window, program or thread. Depends on argument type:

  • wnd - owner window. Will use wnd.IsOwnedBy with level 2.
  • string - program file name, like "notepad.exe". String format: wildcard expression. Cannot be "" or path.
  • WOwner - WOwner.Process(process id), WOwner.Thread(thread id).

See wnd.getwnd.Owner, wnd.ProcessId, process.thisProcessId, wnd.ThreadId, process.thisThreadId.

also  (Func<wnd, bool>)

Callback function. Called for each matching window. It can evaluate more properties of the window and return true when they match. Example: also: t => !t.IsPopupWindow. Called after evaluating all other parameters except contains.

contains  (WContains)

Defines an object that must be in the client area of the window:

  • UI element: elmFinder or string like "name" or "e 'role' name" or "e 'role'".
  • Child control: wndChildFinder or string like "c 'cn' name" or "c '' name" or "c 'cn'".
  • Image(s) or color(s): uiimageFinder or string "image:..." (uses a uiimageFinder with flag IFFlags.WindowDC).
  • OCR text: ocrFinder or string "ocr:..." (uses an ocrFinder with flag OcrFlags.WindowDC).
flags  (TWFlags)

Trigger flags.

later  (TWLater)

Can optionally specify one or more additional events. This starts to work when the primary trigger is activated, and works only for that window. For example, to be notified when the window is closed or renamed, specify later: TWLater.Destroyed | TWLater.Name. When a "later" event occurs, the trigger action is executed. The WindowTriggerArgs.Later property then is that event; it is 0 when it is the primary trigger. The "later" triggers are not disabled when primary triggers are disabled.

f_  (string)

Caller info parameter

l_  (int)

Caller info parameter

Exceptions
InvalidOperationException

Cannot add triggers after ActionTriggers.Run was called, until it returns.

ArgumentException

See wnd.find.

Property Value
Action<WindowTriggerArgs>

See Also

WindowTriggers.Last

Overload(top)

Adds a window trigger and its action.

public Action<WindowTriggerArgs> this[TWEvent winEvent, wndFinder f, TWFlags flags = 0, TWLater later = 0, string f_ = null, int l_ = 0] { set; }
Parameters
winEvent  (TWEvent)

Trigger event.

f  (wndFinder)
flags  (TWFlags)

Trigger flags.

later  (TWLater)

Can optionally specify one or more additional events. This starts to work when the primary trigger is activated, and works only for that window. For example, to be notified when the window is closed or renamed, specify later: TWLater.Destroyed | TWLater.Name. When a "later" event occurs, the trigger action is executed. The WindowTriggerArgs.Later property then is that event; it is 0 when it is the primary trigger. The "later" triggers are not disabled when primary triggers are disabled.

f_  (string)

Caller info parameter

l_  (int)

Caller info parameter

Exceptions
InvalidOperationException

Cannot add triggers after ActionTriggers.Run was called, until it returns.

Property Value
Action<WindowTriggerArgs>