SetMetaTag for JsonString

• May 4, 2018 - 08:38

Hi,
I will create a Plugin that store selected input value of a user interface on the score/cursor.
The input data were selected from a user, and this I will put into a JSonString with the id of the tact, since the input value that the user can select will store on the tact. And latter the user selects this tact the user can see the selected information. I will call these elements for this tact by his id
Witch JSON. stringify (obj) I create a Json string of my object, then I make cursor. setMetaTag ("Theory", json2) but I get the error <>
The questions are. How to fix this? Is it not possible to store this on the score and call this later?

Thanks in advance for help

Attachment Size
Function to store a Json on the score.txt 600 bytes

Comments

In reply to by jeetee

Ok,
I think that it works, I can store a Json with different content to a "tact" (it is more the cursor. tick that I use to select the tact, this was the id where the data will "store" on the metatag/score). I use the function
curScore.setMetaTag (cursor.tick, Json-sting) and curScore.metaTag (cursor. tick).
curScore is from the Score class.

But give it an example for a network connection to a server, where I can send the Json-string to download/get the correct image/links etc..
And is it possible to create a network connection with MuseScore?

In reply to by Sam009

I think its still better practice to have your plugin only create a single metaTag, just out of the point of clean storage and to minimize the chances someone or something else overwrites your data.
You can see all metaTags of a score under File → Score Properties, it makes much more sense to have a single tag named myPluginData rather than a bunch of numeric tags.

JSON (JavaScript Object Notation) is only that, a way to store/retrieve a single JavaScript object. So try to have your plugin work on a single JavaScript object (perhaps look into associative arrays to build up your list within a single object). Do all data manipulations on that single object, then set the whole object as a metaTag.

I'm unsure whether we include all the required libraries for QML WebView by default, but feel free to test it out :)

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