Getting text frames attached to page?
From reading through the forum, I think the answer is ’No, you can’t’, but has anyone worked out a way of getting text frames attached to pages?
I know you can get the values of curScore.scoreName and curScore.composer, but often the user has manually overridden these values in the main text frame, without actually changing their underlying values, so that these values are not a reliable indicator of what actually appears on the score.
In addition, the user will often add subtitles, etc., which are unaccessible by a plugin as far as I can tell.
Here’s what I’ve tried so far:
— (Selection method) The main text frame is not selected when you Select All, so is unavailable through curScore.selection.elements
— (Cursor/Segment loop method) There is no segment filter or segment type associated with text frames
— (Other method) Neither curScore, Pages nor Systems have any way of accessing their children or lists of elements associated with them
— (Ideal) Ideally, it would be great if the API would let you ask for curScore.elements or, even better, curScore.elementsOfType(x)
I know some of you will suggest parsing the underlying XML or mscz file, but it’s really not that vital or important that I can be bothered :-)
Comments
I see that no one really answers you... it will be up to me. If i had your need (which i don't have) i would do this: you could select all the text elements contained in the TextFrames (type == 6: not to be confused with the other types of text) with the context menu 'Select -> All Similar Elements', and at this point i would have them all in 'curScore.selection.elements', and i could identify them (composer, title, etc.) through the 'subStyle' property, as well as access them (or modify their contents) with the usual 'text' property.
In reply to I see that no one really… by ILPEPITO
That's an interesting idea. The slight downside is that in order to be able to select similar elements, the plugin would have to insert a text frame first, do the processing, and then delete the text frame.
I mean it's plausible/possible, but feels like there should be an easier way.
In reply to That's an interesting idea… by michaelnorris
I don't know the overall architecture of your plugin, so i can't answer your objections, and after all it's mostly your business :-). I will limit myself to observing that: the child-parent hierarchy is: TEXT (the text element in the TextFrame) ---> VBOX or HBOX ---> SYSTEM... ooops we don't have the SEGMENT! Very bad deal... Other than that, it doesn't seem like you've been inundated with the answers... In any case, best wishes!