How Do I Cycle Through Different Actions with Each Press of the Hotkey?

I'm looking to try and and make a macro that the first time I press it writes string 1, the second time it writes string 2, the third time it writes string 3, then the fourth time it loops back to string 1.

I've tried using the pause until functionality but found that it seems quite unresponsive and caused some issues for me.

What are people's suggestions?

This seems like a perfect use case for Switch/Case. Replace strings and hotkey as needed for your needs:

Example Macro.kmmacros (4.1 KB)


That's perfect, thanks very much.

@jamheald, I hope you don't mind that I have revised your topic title to better reflect the question you have asked.

One button cycling through different actions

How Do I Cycle Through Different Actions with Each Press of the Hotkey?

This will greatly help you attract more experienced users to help solve your problem, and will help future readers find your question, and the solution.

The above a macro does not paste anything, even though I can tell there is an attempt to run the macro based on the wiggle of the icon in the menu bar of my mac. It seems that the macro is broken. Could someone please update the macro to work again?

Howdy, welcome to the forum! As you might have already figured out, this is a great community full of people who love to help.

The macro seems to work fine for me. Have you modified your copy in any way? Can you verify that your macro and macro group are both enabled? Also, try adding a simple notification at the very beginning of the macro so you can see if it really is being triggered. If none of that works, let us know and we can go from there.