open a 4.x score with MU3.7
I'm trying to open a MU4.x score with the API and MU3.7:
onRun: {
var thisScore = readScore("D:\\Misc\\temp\\HelloMU3.mscz", false);
console.log(thisScore.title);
var thisScore = readScore("D:\\Misc\\temp\\HelloMU4.mscz", false);
console.log(thisScore.title);
}
}
And it fails.
If I set the interactive
flag to true, MU popups a warning that the score is a MU4.x score. If I click on Ignore, the score is processed as accepted.
If I set the interactive
flag to false, the score is not opened.
So "interactive=false" ≡ "stop opening the score if any warning".
Is this the expected behaviour ?
How could I, in non-interactive mode, force the score opening despite the warning ?
Comments
There is a a 'force' option, -f or --force, not sure wether and how it could get set from within a plugin
In reply to There is a a 'force' option,… by Jojo-Schmitz
Thanks. I will have a look.
In reply to Thanks. I will have a look. by parkingb
I tried it from the command line (I couldn't figure out another place to use it) but it has no effect
"C:(...)\bin\MuseScore3.exe" -f "D:\Misc\temp\HelloMU4.mscz"
MU starts and shows the warning message.
In reply to I tried it from the command… by parkingb
-f only works in converter more, so in connection with a -o outputfile option
In reply to -f only works in converter… by Jojo-Schmitz
This is actually my use case. I will try it.
In reply to This is actually my use case… by parkingb
This is the culprit code:
ignoreWarnings
gets set by -f,converterMode
gets set by -o, ``canIgnore` gets checked for certain errors, file to old or to new or corrupt is setting it to true, criticall corrupted, not existent and some other to falseIn reply to I tried it from the command… by parkingb
Maybe -t works here?
In reply to Maybe -t works here? by Jojo-Schmitz
No, it doesn't...
In reply to I tried it from the command… by parkingb
Let me see whether I can get -f or some other option to work
In reply to Let me see whether I can get… by Jojo-Schmitz
I'm considering to remove the "
converterMode &&
" condition from the above mentioned codeSee https://github.com/Jojo-Schmitz/MuseScore/pull/654, give the artifacts a try
In reply to See https://github.com/Jojo… by Jojo-Schmitz
Great! I'll have a try tomorrow...
In reply to See https://github.com/Jojo… by Jojo-Schmitz
This goes beyond my knowledge of GitHUb :-/ How can I found that specific artifact ?
In reply to This goes beyond my… by parkingb
Which OS?
In reply to This goes beyond my… by parkingb
And see https://github.com/Jojo-Schmitz/MuseScore/wiki
In reply to And see https://github.com… by Jojo-Schmitz
Thanks. I found it. That wiki is very useful.
In reply to See https://github.com/Jojo… by Jojo-Schmitz
It is working fine. I tested from both the command-line with the -f flag:
And from the plugin Creator:
The only observation I would make, is that a MU4 score gets automatically a status "modified" and when closed by
closeScore
a popup "Save the change before closing ?" is shown.In reply to It is working fine. I tested… by parkingb
not showing that dialog when opening any corrupt or wrong version scores, and not only in vonverter mode (i.e using the
-o filename
option.In reply to It is working fine. I tested… by parkingb
BTW: you seem to be using true and false the wrong way round, the variable is called
noninteractive
, so is supposed to betrue
if non-interactive andfalse
if interactiveIn that
true
case, non-interactive, it should not prompt for saving, and now also not ask for confirmation on load.In the
false
case, interactive, it should to both, ask confirmation and ask for savingIn reply to It is working fine. I tested… by parkingb
Do you have some working plugin code (not just a snippet) for me to test this?
In reply to Do you have some working… by Jojo-Schmitz
You can test with Batch Convert.
* Don't open any score
* Start Batch Convert, and selection the option "Import"
* Select a Folder where there is some MU4 file
* Check the option "Filter files with", and add some expression to limit to one MU4 file
* Click on "Preview"
As the code says
thisScore = readScore(fileFullPath, true);
, I expect the plugin to open and close the score without any further interaction. This is not the case.On the contrary, if I change the code to
thisScore = readScore(fileFullPath, false);
the plugin doesn't prompt at the score opening, but does so at the file closure.In reply to You can test with Batch… by parkingb
OK, I believe I've found my logic error, please try the new artifacts (once they are ready)