I am trying to automate inDesign to create text frames from a JSON file, where every record shall be placed in a text frame, which is right below the foregoing record.
var tweets_json = '[ {"name":"record_1"}, {"name":"record_2"}, ... ]'; // I have not yet figured out how to import external JSON files, so tor testing this is my current way to go
var tweets = eval("(" + tweets_json + ")");
for ( var t = 0; t < tweets.length; t++ ) {
var newTextFrame = page.textFrames.add();
newTextFrame.textFramePreferences.autoSizingType = AutoSizingTypeEnum.HEIGHT_ONLY;
var tweet = tweets[ t ];
newTextFrame.parentStory.texts.item(0).applyParagraphStyle(styleContent, true);
newTextFrame.geometricBounds = [y1,x1,y2,x2]; // Ignore values
newTextFrame.contents = tweet.name;
}
I started inDesign scripting a few days ago and the documentation is hard to find the solution i am looking for, especially with my basic JavaScript knowledge, so any help is appreciated! Thank You!
