Hey @skillet,
That works nicely.
One tip though:
I get nervous when talking to UI-Elements by number and always prefer to anchor via name, description, accessibility-description, help-text, or whatever else is available.
Numbered items are too easily rearranged by developers and that can cause all sorts of mayhem in UI-scripts than rely on them.
Have a peek at my script and note how it differs from yours:
Toggle the enabled/disabled state of the selected macro(s)
-Chris