Loop over graphics with InDesign
I can fit frame to content on all graphics with
var g = app.activeDocument.allGraphics;
for (var i = 0; i < g.length; i++)
{
g[i].fit(FitOptions.FRAME_TO_CONTENT);
}
Yah! ...Only, I want to find out the specific graphically cropped offenders:
for (var i = 0; i < g.length; i++)
{
alert(g[i].name); // also not working
var sel = g[i]; // not working
var ff = sel.frameFittingOptions;
var cropped = false;
if (ff.topCrop > 0) cropped = true;
if (ff.bottomCrop > 0) cropped = true
if (ff.leftCrop > 0) cropped = true
if (ff.rightCrop > 0) cropped = true;
if (cropped == true)
{
alert("cropped!");
sel.fit(FitOptions.FRAME_TO_CONTENT);
cropped = false;
}
}That second snippet won't fully work as each graphic is not selected and the alert won't work as required.
Long time Photoshop scripter, first time INDD caller. Two things:
1, Do I have to select each graphic in turn or can I just create a reference to one?
2, Where am I going wrong with .name convention?
