This content has been marked as final. Show 7 replies
An anchored textframe is a child of another textframe. So it would be something like mydoc.Pages(i).TextFrames(j).TextFrames(k).Select().
Or better, if all frames are anchored within one story, use that story's TextFrames collection.
I am new to indesign scripting. Post sample code for Stories textframe collection. It would be helpful.
Are you using CS2 or CS3. The answer to your question is different according to the version you're using because of a change in the object model with CS3.
Use the Object Model Viewer (OMV) in ESTK 2's Help menu to explore the CS3 object model.
I am using CS2 with vb.net.
I want to select all the anchored textframes named "RemAnchor" in a .indd file then copy the contents with page number in a text file.
This does work for textframes but it's not working for anchored frames.
For h = 1 To mydoc.Pages.Count
For j = 1 To mydoc.Pages(h).TextFrames.Count
For k = 1 To mydoc.Pages(h).TextFrames(j).Paragraphs.Count
There is more than one way you can tackle this. You could start with the stories and check to see if the first frame of each story has the appropriate label and which has a parent of character (which tells you that it is anchored).
to get an array of the anchored text frames in the story.
In either of these approaches, you'll then need to seek out the page by looking up the parental chain.
If you want to start with the pages, then, as you've discovered, the textFrames property of a page gives you only the frames that are free-standing on the page, so you don't get the anchored ones. What you could do is use the page's allPageItems property -- that'll give you all the page items on the page including the anchored one. You could then check each to see (a) if it is a text frame, (b) if it has the right label, and (c) if is in indeed anchored (as above).
By the way, I said that CS2 and CS3 are different, but actually:
will get all the anchored text frames of myStory in both CS2 and CS3. It's just that in CS3:
gives you the anchored frames in myStory while in CS2 it gives you the frames that make up the story.