Skip to main content
Participating Frequently
February 20, 2015
Answered

Find threaded text frames in document

  • February 20, 2015
  • 2 replies
  • 1956 views

Hi All,

I have created document with 30 pages, It contains both threaded textframes and un-threaded textframes. I have to write scripting tool to find the un threaded text frames and anchor them to next frame to flow with the content.

Any help will be greatly appreciated.

Thanks in advance

This topic has been closed for replies.
Correct answer Jump_Over

Hi Laubender,

Please find the conversation which i had with 'Jarek'. I have explained the problem where I'm facing.

Hi Jarek,


Thanks for findings.


Sorry for not detailing with the logic.


Yes, I have found my logic. Let me explain, and I request your valuable time to read this.


I have InDesign Document with fully formatted. It also contains unthreaded text frames and Graphic rectangle frames (Images) with no anchoring. I have to write tool to do following tasks.


  1. Open InDesign document
  2. Anchoring unthreaded text frames and Graphic rectangles to the previous or next text frames. ( I’m struck in this step)
  3. Applying styles using external style sheet.
  4. Then export document to epub v3.0.

I have logic to do further steps except step 2 of finding previous textframe of unthreaded text frame.

Please find the below screen shot for better understanding.

..................................

Thanks

Suneetha.


Hi,

I dont know what specific solution can be found using ID 2014 CC features in UI but a generic way could be to create a function and call it for each page in a doc. The function would:

  • collect all pageItems (array)
  • sort them by geometricBounds[0] value (ascending)
  • iterate through and:
    1.      each time current item is a threated textFrame ==> set its last insertionPoint as a destination
    2. otherwise ==> anchore item in current destination (not sure if original visibleBounds are essential to be copied)


It assumes the order of pageItems can be based on its top position.


Jarek

2 replies

Jump_Over
Legend
February 20, 2015

suneetha.s napisał(-a):

...I have to write scripting tool...

Hi,

Did you write any part? Did any particular problem stop you?

Jarek

Participating Frequently
February 23, 2015

Hi Jarek,

I'm done with other part of scripting, but to continue further I need to know how to check unthreaded text frames in the document.

Please find the screen shots below for more details on the issue i'm working on.

The document have multiple text frames. And in the example screen shot you can notice the text is flowing from first page to second page.

In first page we have 3 text frames. 1 text frame has the content and next two text frames are graphic and caption (i.e. Graphic text frame & Text frame)

Now I have to write script to find the un-threaded text frames in the document and anchor them to before or after textframes.

Ex: The first Graphic frame (Unthreaded text frame 1) should anchor to end Insertion point of Learning objectives text frame and the next Text frame (Unthreaded text frame 2) should anchor next to graphic frame .

Jump_Over
Legend
February 23, 2015

Hi,

There is many ways to detect unthreated textFrame. One of them is to check if textFrame.parentStory.textContainers.length == 1

However described goal looks like much more complex and involves many questions:

1. what do you mean by "graphic text frame"?

2. could one page have more threated textFrames than one?

3. could your doc have more threated stories than one?

4. could any threated textFrame be empty (i.e. text overflown)?

5. could your doc have many layers?

6. what about other objects (graphic lines, polyghons)?

....

Some answers could involve more questions.

In case of anchoring object ==> you can not move them (if found) into chosen insertionPoint.

You have to recreate them or place them in this location.

So solution could be to temporary export proper object as snippet and place them with calculated achoredObjectSettings

Maybe easier is to reconsider your goal ... ?

Jarek

Peter Spier
Community Expert
Community Expert
February 20, 2015

moved to the scripting forum...