I try to modify the code but it seems to be a problem.
I would use a .txt file with 3 columns and to use numbers with decimals.
Ok I added the code to the 3 columns but I do not know how to modify the code to use numbers with decimals. And my other problem is that the script seems to only read the first line in the .txt file. The script does not give me an error but does not work completely.
does anyone know?
Example of my text in the .txt file:
33 66 1569
55 22 1256
5.5 10.5 8956
33.5 33.5 5842
33.5 33.5 9856
and this is my code:
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(“”);
for (var i = 0; i < content.length – 1; i++) {
var curLine = content[i].split(“”);
var w = curLine[0];
var h = curLine[1];
var c = curLine[2];
docName = w + “X” + h + “_” + c ;
try {
var newDoc = app.documents.add(false);
newDoc.documentPreferences.pageHeight = h;
newDoc.documentPreferences.pageWidth = w;
newDoc.save(new File(folder + “/” + docName + “.indd”));
newDoc.close(SaveOptions.no)
} catch(myError){}
}