Change the Current Score in a Plugin

• May 8, 2021 - 12:10

If you use a command such as cmd("copy"), the copy action takes place on the current score.
After using a cmd("Copy" ) I would now like to apply a cmd("paste") so that the copied material is pasted into a different score.

How can you make a different score the current score in a plugin?
Or alternatively is there a another way to make a command apply to a different score?


cmd() actions always apply to the current score (just like in the program). I'm not sure how to change the current score (you could try the next-score command?)

It seems that curScore itself is read only, as is the scores array.

In reply to by jeetee

Thanks, the next-score command will do the trick. It cycles through the open scores making the next score (to the right) in the interface the active/current score. When called when the last (right most) score is current it will cycle back to the first (left most) score in the interface.

I have a query though. I use the following reference for a list of available commands:…

But this list does not appear to have the next-score command listed. Is there another more complete list of commands? If so could you provide a link.

In reply to by barryw12

You're right. Interesting. I just tried a search for the text "next score" in the whole repository.

You can see what appears to be the "Shortcuts" defined for the user interface in the file
MuseScore/src/framework/shortcuts/data/shortcuts.xml. Line #830 defines "next-score."

In the file src/plugins/api/qmlpluginapi.cpp I see the source code:

void PluginAPI::cmd(const QString& s)

I haven't tried to trace down if the shortcut list in the XML file is what shortcuts() is processing. But that directory for "shortcuts" contains files which suggests to me that that XML file may hold some, or all, of the keys (literally and figuratively!). src/framework/shortcuts/

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