KeyRoutines
ConditionProcond.script.result

Branch a routine on a PowerShell or script result

Script result looks at what an earlier script step gave back and answers true or false. It needs KeyRoutines Pro and turns script output into a simple decision, so the rest of the routine can stay script-free.

KeyRoutines Pro is a one-time $29.99 upgrade for up to 2 PCs.

How it works

  • Pick the Run PowerShell, Run command or Run JavaScript step to check.
  • Check that it succeeded, that its exit code is a given number, that its output is or contains some text, or that it matches a pattern.
  • Text checks ignore upper and lower case and the final line break.
  • It only reads the step's saved outputs and runs nothing itself; a step that hasn't run yet simply counts as not matched.

Routines that use it

Only notify on failure

After Run command runs a backup tool, Script result checks the exit code and Show banner warns you only when it isn't 0.

Git branch check

Run command calls git to print the current branch, and if the output is main, Ask Yes or No confirms before continuing.

Server status

Run PowerShell tests a service; if the output contains Stopped, Send webhook alerts your Discord channel.

Settings

SettingWhat it does
StepThe script step to check (Run PowerShell, Run command or Run JavaScript).
CheckWhat to check.
Exit codeThe exit code it should have.
TextThe text (for is and contains, ignoring case and the last line break), or a pattern (regular expression).

Good to know

  • It checks script steps only; for other steps use Step succeeded or Compare values.

Questions

How do I check a script's exit code in a routine?
Add Script result after the script step, choose 'exit code is' and enter the number. Use it in an If to run different steps for each outcome.
What if the script step was skipped?
A step that hasn't run counts as not matched rather than an error, so the routine keeps going down the 'no' branch.

Pairs well with

Build this routine in KeyRoutines

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