Post your AHK script, along with detailed comments about what each line does (if not obvious), and then we can offer some guidance.
Having said that, the Mac is different from Windows in so many ways, the best approach might be for your to list the Mac workflow you want to automate, step by step.
@valcito, welcome to Keyboard Maestro (KM) and its Forum.
KM is one of the best Mac automation tools available, its Forum is one of the best and friendliest forums on the Internet. Whenever you reach a tough stumbling block trying to use KM, please feel free to post your question/problem here for help.
Not from the code... It's been 15 years, since I've touched AHK, and I'm not aware of anyone on the forum who actively uses it. I don't know everyone, so maybe you'll get lucky and someone will chime in.
Otherwise and in general – you'll have to more definitively define what you're trying to accomplish.
If you haven't seen these they're worth a moment of your time:
I was using the script in Windows to play a version of the game Worms Armageddon.
The script is basically remapping 3 keys but somehow you could overpass a certain technical restriction. The restriction to let the system to recognise two keystrokes at once by pressing both at the same time.
I think this has something to do with the send {Space up} send {Space down} part. Maybe I'm wrong tho.
For more clarification; The keys Z and X are both activating Space but somehow the script can overcome the delay between the keystrokes.