Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var file = File.openDialog("Select Your Text File", undefined, false);
- var folder = Folder.selectDialog("Select the folder where the new documents should be saved");
- file.open("r");
- var content = file.read().split("\n");
- for (var i = 0; i < content.length - 0; i++) {
- var curLine = content[i].split("\t");
- var h = curLine[18];
- var w = curLine[17];
- var c = curLine[0];
- var vw = curLine[19];
- var vh = curLine[20];
- docName = "w + "x" + h + "mm";
- try {
- var newDoc = app.documents.add(false);
- var page = newDoc.pages.item(0);
- newDoc.documentPreferences.pageHeight = h;
- newDoc.documentPreferences.pageWidth = w;
- // Location text frame
- var y1 = 25; // upper left Y-Coordinate
- var x1 = 25; // upper left X-Coordinate
- var y2 = 75; // lower right Y-Coordinate
- var x2 = 300 // lower right X-Coordinate
- if (w > h) {
- var tf = newDoc.textFrames.add({contents: "Aspect Ratio:" + " " + w / h, geometricBounds: [y1, x1, y2, x2]});
- var tf_change = newDoc.textFrames[0];
- tf_change.parentStory.appliedFont = "Arial\tBold";
- tf_change.parentStory.pointSize = 72}
- else {
- var tf = newDoc.textFrames.add({contents: "Aspect Ratio:" + " " + h / w, geometricBounds: [y1, x1, y2, x2]});
- var tf_change = newDoc.textFrames[0];
- tf_change.parentStory.appliedFont = "Arial\tBold";
- tf_change.parentStory.pointSize = 72}
- page.marginPreferences.properties = {top : vh, bottom : vh, right : vw, left : vw};
- newDoc.save(new File(folder + "/" + docName + ".indd"));
- newDoc.close(SaveOptions.no)
- } catch(myError){}
- }h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement