Select next chord after current selection

• Jun 23, 2021 - 14:42

I need my plugin to select the next chord after the current selected chord(s):

I know that I can access and set the selection with (documentation).

But how to get the next chord element after the current selection? I tried this:

    function proceedToNextChord() {
        var cursor = curScore.newCursor()
        cursor.rewind(2) // goto end of selection
        console.log( // next segment, logs false ("end of score")
        var element = cursor.element // returns null
        if (element) {

But it looks like cannot go beyond the current selection. Any ideas on how to get the next chord?


Wouldn't cmd("next-chord") work out? Then select-next followed by select-prev will likely select that.

Just like how I would do it in the UI manually:
1. Press right arrow key
2. Press Shift+right arrow (selects this + next)
3. Press Shift+left arrow (removes next from selection again)

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