Copy link to clipboard
Copied
Does anyone know of a script for InDesign CS4 that will lengthen all the frames (vertically) throughout a document to fit the text when there is overset text and shorten the frame when the text doesn't fill out the full height of the frame?
try below one
var myDoc = app.activeDocument;
var mytextframe = myDoc.textFrames;
for (a=0; a<mytextframe.length; a++)
{
mytextframe.fit(FitOptions.FRAME_TO_CONTENT)
}
it will work if your text frame fit within your page else it leave as overset text frame.
Shonky
Copy link to clipboard
Copied
try below one
var myDoc = app.activeDocument;
var mytextframe = myDoc.textFrames;
for (a=0; a<mytextframe.length; a++)
{
mytextframe.fit(FitOptions.FRAME_TO_CONTENT)
}
it will work if your text frame fit within your page else it leave as overset text frame.
Shonky
Copy link to clipboard
Copied
Cool! Works like a charm. Thank you, Shonky!
Copy link to clipboard
Copied
Can you let it only target
Currently selected text box
Instead of all the text of the current document
This will help me thank all that can solve this problem.
Copy link to clipboard
Copied
I hope someone can modify it.
Let it only target the currently selected object
Copy link to clipboard
Copied
Try the following
if(app.selection.length > 0)
app.selection[0].fit(FitOptions.FRAME_TO_CONTENT)
else
alert("Please select an object before running the script")
-Manan
Copy link to clipboard
Copied
Thank you very much, he is very effective.
But if multiple objects are selected, can they be adjusted together?
Copy link to clipboard
Copied
Here you go
if(app.selection.length == 0)
alert("Please select an object before running the script")
else
{
for(var i = 0; i < app.selection.length; i++)
if(app.selection.constructor.name == "TextFrame")
app.selection.fit(FitOptions.FRAME_TO_CONTENT)
}
-Manan
Copy link to clipboard
Copied
thank you very much
It is perfect now
May the Lord Jesus be with you.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now