Browse the docs

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 #

ParameterTypeRequiredValuesWhat it does
patterntextYesText or a regular expression, depending on mode.
modeone ofcontains equals regexcontains, equals or regex (default).

Examples #

Only in a Slack channel
When
  1. Press ⌃⌥J
Only if
  1. If the window title matches “^#”
Do
  1. Show “A channel window”
Open in Switchboard to try it
Only in an untitled document
When
  1. Press ⌃⌥J
Only if
  1. If the window title contains “Untitled”
Do
  1. Show “Untitled window”
Open in Switchboard to try it

Gotchas #

  • An invalid regular expression makes the condition error rather than fail.

See also #