Importing a .csv or .txt file into InDesign using Javascript to alter page attributes (and more).
Hi there,
Semi-new to scripting in general, very new to scripting for InDesign.
What I've been trying to figure out is exactly (and I do mean exactly!) how to import a .csv or a .txt file into a Javascript script, containing values that I can then designate to variables, and in turn use those variables to create a new InDesign document. I'd prefer to do this all from within the script… not importing anything using the DataMerge feature.
For example, the .csv file might look like this:
Height, Width, Margin, Bleed, AllBleed
17, 11, .5, .125, true
Then the script would import this file, and from the data it gets, creates the following variables:
var myHeight = Height;
var myWidth = Width;
etc.
From which the script would then create my document using myHeight, myWidth, myMargin, etc.
How would I go about doing this? And as a bonus, how would I do this for multiple documents (when the .csv file has multiple records)?
Thanks for any assistance on this!
-jOE
