Reopen the application programatically without option to restore previous session
Is there a way to reopen the program after modifying an xml file of the currently open score?
After modifying a music xml file, I want to programatically reopen the program with the modified changes. Is there a way to do so using the command line options of Musescore?
At the moment what I tried to do is kill the process if it is open with the path of the modified file and reopen it with that file using the command line options.
However, when the program starts it allows me to choose whether I want to restore the previous session. Is there to reopen the program in a cleaner way without getting a message regarding restoring the previous session?
Comments
Try closing it in a proper way; rather than kill it, send it a Quit signal.
In reply to Try closing it in a proper… by jeetee
Thank you, I did try this as well, but it results in a pop up message, saying:
'Save changes to the score "xyz" before closing'
so in this case I also have to click Discard, instead of it reopening automatically without any interaction.
Any other way?
In reply to Thank you, I did try this as… by avivo
Let's back up a bit; what are you trying to achieve by editing a file that simultaneously has unsaved changes?
In reply to Let's back up a bit; what… by jeetee
I have an external program making changes in the xml file directly. When saving the XML file after editing, I want to automatically see the changes in the MuseScore program without having to manually close it and reopen it.
At the moment I have that happening, except for the fact that I have to go through that pop up message. The file is actually saved through the editor (notepad++) after I edit it, so I hoped it wouldn't make me save it inside the program as well when sending it a signal to quit.
If I understand correctly, you are trying to get an external program to communicate with MuseScore, with a goal of getting MuseScore to close a currently-open score and then reopen it? And you are currently trying to get this to happen by killing the MuseScore process then restarting it via the command line?
I wouldn't be doing that. I would instead try to send MuseScore the actual commands you want via OSC. It looks there are commands for "/close-all" and "/open", which should do the job without the need to kill the process or restart it.
In reply to If I understand correctly,… by Marc Sabatella
You got it completely right. I want that whenever I save a music XML file in an editor outside of MuseScore, I would automatically see the effects inside the program, like "refresh" it. I can't find anything regarding the "/close-all" or "/open" command. Is there any documentation or a link you could provide?
In reply to You got it completely right… by avivo
See the pathcommands initialization at https://github.com/musescore/MuseScore/blob/master/mscore/osc.cpp#L63