Rename and Number elements by Level

This threat and script in theory, should be the solution

It worked for the OP there but results in an error when I tried


That thread was closed so I am not able to ask about it.