Skip to main content
Participant
December 23, 2024
Question

Problem Threading Existing Text Frames to Each Other

  • December 23, 2024
  • 2 replies
  • 198 views

I have inherited some documents from a client where all the text frames are not threaded. When I click the out-port of a frame and then hover over the area of the in-port frame that I want to thread it to, I see the cursor change to the thread icon, but when I click, it creates a blank text frame and threads to it. 
All frames are on the same layer and unlocked. I am showing all frames but I am unable to target the in-port of the frame I want to link to. Is there a way to display the in/out ports without hovering over them? Is there something I am missing in doing what should be a simple task?
Thanks in advance for any help.

This topic has been closed for replies.

2 replies

Robert at ID-Tasker
Legend
December 23, 2024

@Synthtony

 

You don't have to click exactly over the in-port - just over the destination TextFrame.

 

Community Expert
December 23, 2024

Hard to know what's going on without seeing the file or some screenshots etc. 

 

Here's a script if it helps to thread them for you - but best to find out what's causing it not to work.

 

Be interested to see more of the file itself or your screenshots/layers panel etc. 

 

// Check if at least two text frames are selected
if (app.selection.length < 2) {
    alert("Please select at least two text frames.");
} else {
    try {
        // Store selected text frames
        var selectedFrames = app.selection;
        
        // Sort selected items based on geometricBounds (if needed for order)
        selectedFrames.sort(function (a, b) {
            return a.geometricBounds[1] - b.geometricBounds[1]; // Sort by x-coordinate
        });

        // Loop through and thread the text frames
        for (var i = 0; i < selectedFrames.length - 1; i++) {
            if (selectedFrames[i].constructor.name === "TextFrame" && selectedFrames[i + 1].constructor.name === "TextFrame") {
                selectedFrames[i].nextTextFrame = selectedFrames[i + 1];
            } else {
                alert("Selected items must be text frames.");
                break;
            }
        }

        alert("Text frames have been threaded successfully!");
    } catch (e) {
        alert("An error occurred: " + e.message);
    }
}