How to add a measure at score start instead of its end?

• Apr 24, 2022 - 00:24

I can add measures to the score end using "score.appendMeasure(int n)".
Is there a way to add a measure to the start of the score or to any position?

I tried "cursor.AddElement" passing a measure but it ends up at the end of the score and file is corrupted.

    var measure = newElement(Element.MEASURE);
    cursor.add(measure);

Comments

cmd("insert-measure") works! Thanks a lot.
I had to select something first as you mentioned. And I also had to enclose those calls to make the rest of my code run afterwards.

        curScore.startCmd();
        cmd("select-all")
        cmd("insert-measure")
        curScore.endCmd();

Do you still have an unanswered question? Please log in first to post your question.