Reply To: Is there a script to combine selected frames as Threaded Text

#55215

Hey, no prob. I enjoy solving little problems like this ;-)

Try this one for size. Select any amount of unlinked (!) text frames in any screen order, and they'll get linked, top to bottom, left to right. The script will not mess up any existing linked frames, even if some are already linked — it'll skip these and link to their first/last frames instead:

Linked frames, before and after

var combineMe = new Array;

for (a=0; a<app.selection.length; a++)
{
if (app.selection[a] instanceof TextFrame)
combineMe.push(app.selection[a]);
}
combineMe.sort (function (a,b) { return (a.geometricBounds[0] < b.geometricBounds[0]) || (a.geometricBounds[0] == b.geometricBounds[0] && a.geometricBounds[1] < b.geometricBounds[1]) ? -1 : 1; } );
for (a=0; a<combineMe.length-1; a++)
{
if (combineMe[a].nextTextFrame == null)
{
nextFree = a+1;
while (nextFree < combineMe.length && combineMe[nextFree].previousTextFrame != null)
nextFree++;
if (nextFree < combineMe.length)
combineMe[a].nextTextFrame = combineMe[nextFree];
}
}

(Ed.: Forum didn't like font changes :-P Restored to normality — I hope)

This article was last modified on March 22, 2010

Comments (0)

Loading comments...