How to retrieve the text frame containing a piece's title (the one set by curScore.addText("title","some title") ?

• Mar 5, 2022 - 18:30

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 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 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 and prevMeasure are always measures, even if there is a frame, a textframe in between.

In reply to 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

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