-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOLD_splitMyPages.jsx
52 lines (39 loc) · 1.51 KB
/
OLD_splitMyPages.jsx
1
/** splitMyPages for Adobe InDesign CS2** This script will take a document with multiple pages and split off each page into a seperate InDesign file.* Files are named pageX.indd, where X is the page number, and saved in the folder as the original master file.* * @Copyright: (c) Mohammad Jangda ([email protected])* @License: MIT License (http://www.opensource.org/licenses/mit-license.php)**/#target indesign// get the active documentvar myTemplate = app.activeDocument;var myTemplateFile = File(myTemplate.fullName);// with the active document, do stuff!with(myTemplate){ // iterate through all pages for(var num=0; num<myTemplate.pages.length; num++) { // create new document in the background var myNewDoc = app.documents.add(true) // set preferences, particularly size with(myNewDoc.documentPreferences){ pageHeight = "96p0"; pageWidth = "68p3"; } // set page numbering myNewDoc.sections[0].continueNumbering = false; myNewDoc.sections[0].pageNumberStart = (num+1); // copy elements over from template myTemplate.pages.item(num).duplicate (LocationOptions.before, myNewDoc.pages[0]); myNewDoc.pages[1].remove(); // import styles myNewDoc.importStyles(ImportFormat.characterStylesFormat, myTemplateFile) myNewDoc.importStyles(ImportFormat.paragraphStylesFormat, myTemplateFile) myNewDoc.importStyles(ImportFormat.textStylesFormat, myTemplateFile) // close and save as Pagexx.indd myNewDoc = myNewDoc.close(SaveOptions.yes, File ('page' + (num+1) + '.indd')); }}