How to retrieve the text frame containing a piece's title (the one set by curScore.addText("title","some title") ?
Hi,
How to retrieve the text frame containing a piece's title (the one set by curScore.addText("title","some title")
?
Or the one added through the User Interface with Add > Text > Title ?
A curScore.title
returns the score's property "workTitle" which is set by none of the 2 above instructions.
Thanks,
[EDIT] : change the subject to avoid confusion on what I'm trying to achieve.
Previous subject: How to retrieve a piece's title (the one set by curScore.addText("title","some title") _?
Comments
I don't know the details of the plugin interface, but presumably you need to walk through the score looking for vertical frames, and when you find one, look through it for a text element with "title" text style.
Hi, I reworked on this idea.
> but presumably you need to walk through the score looking for vertical frames
I wonder how I can do this... :-/
These are my (unsuccessful) attempts until now:
* The only way I found to iterate through the score was at segment levels. But I could not find any vertical frames.
* The uppermost parent of the vertical frames are a SYSTEM object and a PAGE object. But I couldn't find a way to retrieve the pages of a score.
* Therefore I retrieve a PAGE object by starting from a basic element (a note e.g.) and walking up its parents' tree until I fall on a SYSTEM object. But then I cannot find a way to list all the elements of that SYSTEM
I'm stuck here. Any other suggestion ?
In reply to Hi, I reworked on this idea… by parkingb
Again, I don't know the plugin API, but internally, frames have the same base class as measures. So instead of walking segments, you'd walk "measurebases", and checking each to see if it it a measure or a frame. That's how it would be done internally, so that's how I'd expect it to be exposed if it is.
In reply to Again, I don't know the… by Marc Sabatella
Hi Marc, I know that you are not familiar with the Plugin API. I was hoping for someone with more knowledge about this to pass by ;-)
Anyway, thanks for trying to help me.
But as I far as I been able to observe, in the API, a measure is a measure.
nextMeasure
andprevMeasure
are always measures, even if there is a frame, a textframe in between.In reply to Hi Marc, I know that you are… by parkingb
See also https://musescore.org/en/node/286707.
The discussion there is about curScore.name (not always same as score title) and there is a message that this was fixed, but I tried it just now, and still get
Debug: curScore.name = Score
In reply to See also https://musescore… by elsewhere
Hi,
Retrieving the properties of a score is not a complicated task (°).
What I'm after is retrieving what's inside the text frames.
curScore.addText("title","some title")
doesn't set the "title" property of the score, it adds a text frame of type Title with a some text inside. There are requests to have it coupled to the title property (°°) but for now it isn't.What I'm after is to locate these text frames added by the
curScore.addText(...)
method.(°):
var score=curScore;
console.log("score.scoreName (=filename): "+score.scoreName);
console.log("score.composer: "+score.composer);
console.log("score.metaTag(composer): "+score.metaTag("composer"));
console.log("score.metaTag(workTitle): "+score.metaTag("workTitle"));
console.log("score.metaTag(workNumber): "+score.metaTag("workNumber"));
(°°)
See #266706: Metadata (tags) in frames
In reply to Hi, retrieving the… by parkingb
curScore.scoreName works indeed. Many thanks.
But it remains that curScore.name does not give an error and yields curScore.name = Score
See #337263: Feature: ability to change frame text via plugin API