Add the following macro (and refine ,or fix (only tested basics). Place caret between at [0..|] (where the total count should and innvoke the macro.
...
I opened View -> Editor Macros ...
I recorded a dummy macro, then Edit, then replaced it with your macro from clipboard.
Defined a shortcut, placed the cursor in right spot and run it.
Was it the right thing to do? There could be one more button "Create from Clipboard".
It works somehow, this is a good example. I must study making complex Editor macros, I have only tested with simple ones so far.
Is there any way to debug the macro? I guess not.