KeyRoutines
ConditionFreecond.compare

Compare two values in a Windows 11 routine with one check

Compare values is the everyday yes-or-no check in KeyRoutines. You put a value on the left, pick a test, and put a value on the right, so an If can branch on things like a battery level, a window title or a number an earlier step worked out.

How it works

  • Pick a test: equals, not equal, greater than, at least, less than, at most, contains, starts with, ends with, matches a pattern, is empty, or is one of.
  • Contains works on text, on lists (does the list hold an equal item) and on dictionaries (does it have that key); is one of is the same test the other way round.
  • Text is compared without caring about upper and lower case unless you turn that option off.
  • Matches uses a regular expression with a 100 millisecond limit, so a pattern that would run forever fails instead of freezing the routine.
  • The run history explains the answer in plain words, such as "5 is at least 3".

Routines that use it

Warn when the battery is low

Read a value from an earlier step, compare it with "less than 20", and show a banner with Show banner only when it's true.

React to one window title

When Window title changed fires, compare the new title with "contains Zoom Meeting" and mute the sound with Mute or unmute.

Skip empty clipboard text

After Get clipboard, an "is empty" check stops the routine with Stop routine before it pastes nothing.

Settings

SettingWhat it does
Ignore caseadvancedText comparisons ignore upper and lower case unless this is false.

Good to know

  • Pattern checks stop after 100 milliseconds, so very heavy regular expressions fail on purpose.
  • For checks that combine several tests with and/or, Expression is true is the better fit.

Questions

Can I check if text contains a word in KeyRoutines?
Yes. Choose the contains test and type the word on the right. Case is ignored by default, so "Error" also finds "error".
Does Compare values support regular expressions?
Yes, the matches test takes a regular expression. It has a 100 millisecond limit, and a broken pattern is reported as a setup problem instead of silently passing.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.