Skip to content

Instantly share code, notes, and snippets.

@JeroenSteen
Last active August 10, 2016 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeroenSteen/1634741732218a96348ffb11c79d2452 to your computer and use it in GitHub Desktop.
Save JeroenSteen/1634741732218a96348ffb11c79d2452 to your computer and use it in GitHub Desktop.
Create Indesign document Script
//SRA3 size
var x = 320;
var y = 450;
function range(start, stop, step){
var a=[start], b=start;
while(b<stop){b+=step;a.push(b)}
return a;
};
var xs = range(100, x, 1);
var ys = range(100, y, 1);
for (xi = 0; xi < xs.length; ++xi) {
for (yi = 0; yi < ys.length; ++yi) {
xx = xs[xi];
yy = ys[yi];
var doc = app.documents.add();
with(doc.viewPreferences) {
horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;
}
with(doc.documentPreferences) {
pageHeight = xx;
pageWidth = yy;
pageOrientation = PageOrientation.PORTRAIT;
pagesPerDocument = 1;
documentBleedBottomOffset = "3mm";
documentBleedTopOffset = "3mm";
documentBleedInsideOrLeftOffset = "3mm";
documentBleedOutsideOrRightOffset = "3mm";
}
with (doc.pages.item(0).marginPreferences){
columnCount = 3;
//columnGutter can be a number or a measurement string.
columnGutter = "5mm";
bottom = "1cm"
//When document.documentPreferences.facingPages == true,
//"left" means inside; "right" means outside.
left = "1cm"
right = "1cm"
top = "1cm"
}
//If the active document has not been saved (ever), save it.
if(app.activeDocument.saved == false){
//If you do not provide a file name, InDesign will display the Save dialog box.
app.activeDocument.save(new File("F:/BackUpIomega/OMNIVOOR/IndesignScripts/export_"+xx+"_"+yy+".indd"));
app.activeDocument.close();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment