Copy link to clipboard
Copied
I need help with a script I found and adapted for creating multiple documents from a tab separated text file.
The script creates the documents so far but it doesn't set the margin properties and I have no clue why.
This is the sample txt file:
210 297 20 Name1
2000 4000 300 Name2
210 297 10 Name3
220 440 20 Name4
330 200 15 Name5
and this the js:
var file = File.openDialog("Öffne Text Dokument", undefined, false);
var folder = Folder.selectDialog("Speicherort Dokumente");
file.open("r");
var content = file.read().split("\n");
for (var i = 0; i < content.length - 1; i++) {
var curLine = content[i].split("\t");
var h = curLine[0];
var w = curLine[1];
var mar = curLine[2];
var n = curLine[3];
docName = n + "_" + h + "×" + w;
try {
var newDoc = app.documents.add(false);
newDoc.documentPreferences.pageHeight = h;
newDoc.documentPreferences.pageWidth = w;
newDoc.marginPreferences.properties = {top: mar,left: mar,right: mar,bottom: mar};
newDoc.save(new File(folder + "/" + docName + " .indd"));
newDoc.close(SaveOptions.no)
} catch(myError){}
}
Why does the "marginPreferences.properties" not work?
Thanks in advance for any help!
hi, use this line:
newDoc.pages[0].marginPreferences.properties = {top: mar,left: mar,right: mar,bottom: mar};
Copy link to clipboard
Copied
hi, use this line:
newDoc.pages[0].marginPreferences.properties = {top: mar,left: mar,right: mar,bottom: mar};
Copy link to clipboard
Copied
Great Thanks!