0
New Here
,
/t5/indesign-discussions/batch-create-multiple-documents-with-js/td-p/11640168
Dec 01, 2020
Dec 01, 2020
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!
TOPICS
Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Participant
,
Dec 01, 2020
Dec 01, 2020
hi, use this line:
newDoc.pages[0].marginPreferences.properties = {top: mar,left: mar,right: mar,bottom: mar};
Participant
,
/t5/indesign-discussions/batch-create-multiple-documents-with-js/m-p/11640311#M406035
Dec 01, 2020
Dec 01, 2020
Copy link to clipboard
Copied
hi, use this line:
newDoc.pages[0].marginPreferences.properties = {top: mar,left: mar,right: mar,bottom: mar};
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
dg_huebel
AUTHOR
New Here
,
LATEST
/t5/indesign-discussions/batch-create-multiple-documents-with-js/m-p/11640340#M406036
Dec 01, 2020
Dec 01, 2020
Copy link to clipboard
Copied
Great Thanks!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

