AppleScript/JXA to Enable/Disable a Macro?

I see KM has setmacroenable function for AppleSscript.
However, whenever I run that, it open the keyboard maestro editor.
Is this possible to enable/disable a macro using AppleScript/JXA using KM Engine, so KM Editor doesn’t open?

Create a macro that does the macro enable/disable, and then trigger that macro from script.
See Controlling Keyboard Maestro Engine via Scripting.

Thanks JMichaelTX.
I actually thought about that. However, I have like hundreds of macros,
and it’ll increase the number of macros dramatically if I do that.
It would be amazing if @peternlewis could implement all the KM actions
(that AppleScript can’t do) into AppleScript functions for KM Engine!
I guess I could use doscript, but I have to use plist.
Probably that’s best solution for now?

This would be an impractically large amount of work.

You can execute an action as XML using the do script command, and you can build the XML yourself based on existing actions’ XML.