Error in plugin when using readScore()
This code saves the current score as .mscx; reads it back as a text file; processes the contents with some regex; writes back the text file then finally opens this new score.
Everything works but the readScore() step generates 2 warning messages. Any idea what's wrong?
The FileIO setup looks like this:
Comments
The APIs readScore() and writeScore() are not functional in Mu4 (yet).
See https://musescore.org/en/node/337468
In reply to The APIs readScore() and… by elsewhere
Oops! This is in MS3.6.2
In reply to Oops! This is in MS3.6.2 by yonah_ag
batch_convert.qml has this interesting info:
thisScore = readScore(fileFullPath, true);
In reply to batch_convert.qml has this… by elsewhere
I've now added the missing boolean parameter and assigned a variable called thisScore but it produces a different warning id:
The modified .mscx score does actually open in MuseScore but this warning must be telling me that something is not quite right. I'll see if I can find more examples in other plugins.
In reply to batch_convert.qml has this… by elsewhere
I've checked other plugins but can't see that they are doing anything different. Maybe, since it's only a warning, I can safely ignore it.
In reply to I've checked other plugins… by yonah_ag
Have a look at
https://musescore.org/en/node/336449#comment-1148284
There I used thisScore = readScore(fileName,false) // instead of true (noninteractive = false)
and readscore worked without warnings
In reply to Have a look at https:/… by elsewhere
Thanks! that fixes the warning. :-)
One minor side-effect is that that the original mscz score tab is marked as changed (with a *). I tried adding cmd("undo") but to no effect, presumably because this tab has lost focus to the newly loaded mscx file. Can I re-activate the original tab so that I can apply the undo? It's not a big deal but would be nice.
In reply to Thanks, that fixes the… by yonah_ag
I tried the cmd undo but that did not seem to work (see the same thread)
EDIT: Try ignoring the warnings
In reply to I tried the cmd undo but… by elsewhere
Ignoring the warnings seems to be OK so I'll stick with it. They only show in the plugin editor console so not a big deal.
Do you need to prepend
file://
?In reply to Do you need to prepend file:… by XiaoMigros
I don't think so. Strangely, I can no longer reproduce the error and the code is fully working.