Copy link to clipboard
Copied
Hi all.
I have a user interface that generates a list of dates based on start/end points entered by the user. I'd like it to populate an InDesign template that I've made:
I've assigned the first frame on the master page with the name "begin".
The code I'm using to call the template and populate the text fields are as follows:
var myDoc = app.open ("--REDACTED LOCATION--:testdiary.indd");
while (h < d.length) {
myDoc.textFrames.item("begin").contents += ""+d
+"\r"; h++}
Once I run the script, it finishes with three problems:
As shown in this example:
Until now, my scripting knowledge so far hasn't seen me creating any large scale text documents like this, so this is all new to me. My research so far into this topic talks about generating the text frames as the script goes and basing the next text frame off of geometric locations, but I can't find any documentation into trying to populate text frames in an existing template.
Clearly I'm doing something incorrectly, have missed some steps, or have made a pig's ear of the whole thing. Is anyone able to talk me through what I'm doing wrong and what I should do next?
Colin
Your script finds the 'begin' frame on the master before any others. So you could do
myDoc.pages[0].textFrames.item("begin")
to get the one on the document page, not the master page.
To fill that whole story, no need to iterate through the array. Just do this:
myDoc.pages[0].textFrames.item("begin").contents = d.join('\r')
Peter
Copy link to clipboard
Copied
Your script finds the 'begin' frame on the master before any others. So you could do
myDoc.pages[0].textFrames.item("begin")
to get the one on the document page, not the master page.
To fill that whole story, no need to iterate through the array. Just do this:
myDoc.pages[0].textFrames.item("begin").contents = d.join('\r')
Peter
Copy link to clipboard
Copied
Thank you for that Peter, that worked a charm.