There are several ways to repeat macro and actions in Keyboard Maestro, and the method is different depending on your use case. I’m going to cover my favorite method in this post.

Three main actions that can help you repeat a macro in Keyboard Maestro.

  • Repeat — Repeat a macro for a specified number amount of times.
  • Until — Repeat a macro until it meets a specified condition.
  • While — Repeat a macro while it meets a specified condition.

Most of the time, you only need to use repeat action to loop over the macros. The main advantage is that it allows you to decide how many times you want to run them and save yourself from dealing with the uncertainty of checking variables in Until and While actions.1

For example, sometimes, I need to get the SimilarWeb stats from the websites I found. I put these data in a spreadsheet and enter the number of times I want to repeat the macro that pulls the required information.

Here is the macro that shows you how it works.

Create an action that prompts input from you to enter the number of times you want to repeat a group of actions or a macro. Save to a variable called LocalRepeatAmount.

Create another action that repeats the actions based on the value of LocalRepeatAmount. The combination of repeat action and local variable lets you choose how many times you want to run the macro instead of going back into the editor to update the number of times to run the macro.

  1. These two actions are more suitable when you want to check the environment and screen conditions before you resume actions in a macro.