Here’s a link to an example macro that can be used to get a macro’s name and UUID
And here’s a link to the KM wiki page for the MacroNameForUUID token
These two resources should take you a long way towards figuring out how to do this, but feel free to ask more questions if you need further help.