Keyboard Maestro is great for replicating Auto Hot Key functionality from Windows to Mac. I use this for repeating certain keys in World of Warcraft, so that it makes things easier. (I have rsi in my wrist and this helps)
This is the macro I am using for the current version, Dragonflight.
I am posting this in case anyone else is looking for a AHK solution in mac.
There's another way to achieve what he wants. A few years ago you could purchase an official Blizzard-labelled World of Warcraft Mouse, which had a macro builder, like many multi-button mice do, which enabled you to easily build loops like these. These official Warcraft mice may still be available on eBay. But even if they aren't, you can still get macro-capable mice from Logitech or other companies that sell multi-button mice.
Even if you don't like games, multi-button mice can and do work with Keyboard Maestro for excellent trigger-capable devices. In some ways, they are like a Stream Deck with a free built-in mouse.
And interestingly, Microsoft just bought Blizzard a few days ago (for $70,000,000,000) and since Microsoft is really big on selling their own brand of mice, maybe Microsoft will revive the Warcraft Mouse with its basic macro features.