I'm just demonstrating getting the XML.
Parsing is up to the user.
Although, I think I might have a script somewhere that does it – no, not finding one. I thought that I'd done this with the shell, but I can't find it right now.
@DanThomas' Go To Macro by Name (Spotlight) does this with JavaScript I believe, so you have a starting point.
Keep in mind that getmacros gets all macros.
Gethotkeys on the other hand gets only the macros available in the current context that have a hotkey or type-string trigger.
-Chris