Batch Transpose: Get proper access to the Musescore object model when opening file with plugin

• Oct 31, 2022 - 09:43

We have made 1000nds of note using Muse score. We would like to auto transpose them to other keys such as Bb for clarinets and trumpets or Eb for alto saxophones.
The easy way to do it would be using a muse score plugin.
such as cmd("select-all"); and cmd("transpose-up"), but these commends does not work when the document is opened with the plugin. It is not possible to select and manipulate the note system when a mscz file is opened via macro.
Is there any method I should use that I don't know about? Or is it just impossible what I want to achieve?
Enclosed script opens a file, tries to get access to manipulate the note structure and export the note as SVG (or Png), but it does not work.
Is there another way?


With cmd("next-score") sandwiched between startCmd & endCmd you can make the plugin process multiple files, but beware: next-score cycles back to the first score

To stop it have e.g. an empty score (1 measure) leftmost and run while (mcount != 1)

I managed to open and process 35 lead sheets at a time without problems…

In reply to by elsewhere

Thank you for input elsewhere . But it does not solve my issue.
I have hundreds of documents, and want to open them dynamically one by one
Do somthing (in this case transpose and export an Svg-file)
Then close the document and go to the next.
The problem is that the "cmd" does not work on a document opened by a plugin

In reply to by oleviolin_

For what it is worth...

thisScore = readScore(fileName,false) // instead of true
thisScore.endCmd(); after cmd("select-all");

(Also put your own params in fileName & targetFile)

the score becomes visible and is transposed, but:

the intput score is also changed, and you are asked if you want to save it.

tpcs are not correct

In reply to by elsewhere

Thanks elsewhere. I think I got the concept now. (And it is working!! which is great!!)
No problem pressing the Don't save button 670 times. Since it is do-once job for our team to add Bb notation.
When I finished the project, I would like to start updating the plugin manual, making it easier for newbee's like myself to get started making these kind of plugins.

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