Assert action

The Assert action is a simple new action in Keyboard Maestro 8. It is basically just "if not condition then fail", but this can be a very useful tool for ensuring that your macro has received the right data.

For example, if your macro is expecting you to have copied a URL:

This ensures the macro stops immediately if it is given the incorrect data.

Asserts are a very powerful tool for ensuring correctness, helping you quickly track down and resolve a problem when the macro has gotten the wrong inputs.

11 Likes

I love this! I recently encountered an instance where my macro ran and named files “NoTextInClipboard” (I must have copied an image by mistake). This will be a good way to ensure this does not happen again. I was going to try to use an “if/then” action, but this will be simpler. Thanks!

2 Likes

Great! Much cleaner than using If Then Else actions