Window title
Passes when the front window's title contains, equals or matches your text.
The front window title matches pattern
Keyboard Maestro: FrontWindow (Title...), AnyWindow (Title...)
Details #
Reads the title of the front app's focused window and tests it against pattern. mode is contains, equals or regex; the default is regex, which matches anywhere in the title unless you anchor it with ^ and $. Matching is case sensitive.
Every condition accepts "negate": true, which flips the verdict. The trace records what was compared before the flip, so a negated condition that blocks a macro still shows the real values.
Conditions in an Only if list combine with all: every one must pass, and an empty list always passes. An if step or a repeat loop takes a match of all (default) or any.
The trace shows windowTitle, pattern and mode.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
pattern | text | Yes | Text or a regular expression, depending on mode. | |
mode | one of | contains equals regex | contains, equals or regex (default). |
Examples #
- Press ⌃⌥J
- If the window title matches “^#”
- Show “A channel window”
- Press ⌃⌥J
- If the window title contains “Untitled”
- Show “Untitled window”
Gotchas #
An invalid regular expression makes the condition error rather than fail.