Hello Jelle,
If you have prepared template (e.g. A3) full of graphic frames in certain grid this piece of code will put choosen file into all the frames. If orientation of choosen file won’t conform shape of the graphic frame, script will rottate imported file.
I’ve tested it shortly on Indd files – template A3 and A5. The script should work regardless of format if formats will conform eachother
best
Robert
PS. If you will have problems with copying and pasting code to ExtendScript toolkit write my your e-mail, so I’ll send you a script file.
var toPlace = File.openDialog (‘Select file to place.’, ‘*.*’, false);
if ( !toPlace ) { exit(); }
place ( toPlace );
function place ( file ) {
app.activeWindow.transformReferencePoint = AnchorPoint.CENTER_ANCHOR;
var f = app.activeDocument.rectangles, i = f.length;
while ( i– ) {
try { f[i].graphics[0].remove(); } catch (err) {}
with ( f[i] ) {
place ( file ),
clearTransformations(),
clearFrameFittingOptions(),
fit( FitOptions.CENTER_CONTENT )
}
if ( ( ( f[i].geometricBounds[3]-f[i].geometricBounds[1] ) < ( f[i].graphics[0].geometricBounds[3]-f[i].graphics[0].geometricBounds[1] ) ) ||
( ( f[i].geometricBounds[2]-f[i].geometricBounds[0] ) < ( f[i].graphics[0].geometricBounds[2]-f[i].graphics[0].geometricBounds[0] ) ) ) {
f[i].graphics[0].rotationAngle = 90;
}
}
}