Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. var file = File.openDialog("Select Your Text File", undefined, false);
  2. var folder = Folder.selectDialog("Select the folder where the new documents should be saved");
  3. file.open("r");
  4. var content = file.read().split("\n");
  5.  
  6. for (var i = 0; i < content.length - 0; i++) {
  7. var curLine = content[i].split("\t");
  8. var h = curLine[18];
  9. var w = curLine[17];
  10. var c = curLine[0];
  11. var vw = curLine[19];
  12. var vh = curLine[20];
  13. docName = "w + "x" + h + "mm";
  14. try {
  15. var newDoc = app.documents.add(false);
  16. var page = newDoc.pages.item(0);
  17. newDoc.documentPreferences.pageHeight = h;
  18. newDoc.documentPreferences.pageWidth = w;
  19.  
  20. // Location text frame
  21. var y1 = 25; // upper left Y-Coordinate
  22. var x1 = 25; // upper left X-Coordinate
  23. var y2 = 75; // lower right Y-Coordinate
  24. var x2 = 300 // lower right X-Coordinate
  25.  
  26. if (w > h) {
  27. var tf = newDoc.textFrames.add({contents: "Aspect Ratio:" + " " + w / h, geometricBounds: [y1, x1, y2, x2]});
  28. var tf_change = newDoc.textFrames[0];
  29. tf_change.parentStory.appliedFont = "Arial\tBold";
  30. tf_change.parentStory.pointSize = 72}
  31.  
  32. else {
  33. var tf = newDoc.textFrames.add({contents: "Aspect Ratio:" + " " + h / w, geometricBounds: [y1, x1, y2, x2]});
  34. var tf_change = newDoc.textFrames[0];
  35. tf_change.parentStory.appliedFont = "Arial\tBold";
  36. tf_change.parentStory.pointSize = 72}
  37.  
  38.  
  39. page.marginPreferences.properties = {top : vh, bottom : vh, right : vw, left : vw};
  40. newDoc.save(new File(folder + "/" + docName + ".indd"));
  41. newDoc.close(SaveOptions.no)
  42. } catch(myError){}
  43. }h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement