Need help - clipboard data for paste into MuseScore

• Oct 7, 2019 - 09:42

I'm writing a web app that generates guitar fingerings on screen, see
or its ancestor

... and I'm now exploring how to fill the browser clipboard with my data.

I'd love to be able to paste directly in a tablature in MuseScore.
Is there any simple reference on what data are needed and how the clipboard data must be formatted to be directly pastable into MuseScore?
Did anyone already make anything similar?



The question is indeed interesting but I'm afraid that this may happen to be not possible right now. Technically, you need to put to clipboard some relevant data under one of these MIME formats, depending on what exactly you would like to be able to paste. The format of the data is based on MSCX and you can see some examples of such format by reading the clipboard data of the corresponding type after copying something in MuseScore. On Linux, for example, it is possible to do so with xclip tool:

xclip -o -selection clipboard -t 'application/musescore/stafflist'

The same xclip tool is able to put data to the clipboard, and data put there this way are indeed pasted correctly into MuseScore.

The issue is though in doing all this with a web browser. The only ways to put arbitrary data to the clipboard from a web browser I was able to find is Clipboard.write() function and overriding a clipboard event. The former API seems to be not implemented by most of browsers (see this table, although it may happen to be somewhat outdated), and both ways lead to some application/x-moz-custom-clipdata entry being added to the clipboard (in Firefox) rather than the required application/musescore/stafflist. Moreover, the W3C draft on Clipboard API suggests that this behavior may be intended, and it may happen that no custom MIME types are allowed to be put to the clipboard (although this may concern only the method with overriding copy event).

So, unless I am missing something, it doesn't seem to be possible to do so with a web application, and it is even unclear (for me) whether it will be possible to do so in future. However it should be possible to implement a browser extension which would handle this clipboard issue.

In reply to by dmitrio95

thank you dimitrio95.
I used this example:…
and I'm able to insert some plain text into the Clipboard, but the paste menu remains greyed out in MusesScore... probably for the reasons you explained.
Seems the only way is going for a MusicXML export/import... a bit cumbersome.
Could this be a valid suggestion for future versions? Or am I the only interested in doing these weird things?

Hi. I have a partial solution - you can easily export / import to Musescore using a MusicXML file. I tried it myself and it works. An example file is shown below.

Attachment Size
sample_note.xml 1.38 KB

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