KeyRoutines
ConditionFreecond.expression

Write your own true-or-false check for a Windows routine

Expression is true is the power-user condition. Instead of filling in a form, you type a short expression, for example a counter of at least 3 and Visual Studio Code in front, and the routine treats the result as yes or no.

How it works

  • It can read the same values your step settings can: earlier step results, variables, routine inputs, the trigger, the current loop round, remembered values and information about the PC.
  • It never reads your saved secrets; an expression that tries is refused when it's checked.
  • Empty text, 0, an empty list, an empty dictionary and nothing at all count as false; everything else counts as true.
  • A typo or a value of the wrong type fails the step with a plain message, rather than quietly guessing.
  • Inside a Repeat or a Wait until it's only read once, so checking it over and over stays cheap.

Routines that use it

Only after the third try

Count attempts with Set variable inside a Repeat and leave with Stop repeating once an expression says the count is 3 or more and the app is ready.

One check for two conditions

Before Press keys, test that the right app is in front and a remembered value is on in a single expression instead of two nested Ifs.

Wait for a calculated value

Use the expression in a Wait until to hold the routine until a value from Calculate passes a threshold.

Settings

SettingWhat it does
ExprAn expression that is true or false, such as vars.count >= 3 and env.frontmostApp.exe == "Code.exe".

Good to know

  • You need to type the expression yourself; there's no form for it.
  • Saved secrets can't be used inside an expression.

Questions

What counts as false in an Expression is true check?
Empty text, the number 0, an empty list, an empty dictionary and no value at all are false. Anything else is true.
Do I need to know programming to use KeyRoutines conditions?
No. Most checks are covered by Compare values and the other form-based conditions. Expression is true is there for people who prefer typing one line.

Pairs well with

Build this routine in KeyRoutines

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