Skip to main content
Participant
January 23, 2008
Question

auto Data merge

  • January 23, 2008
  • 24 replies
  • 2533 views
Hallo,

I hope someone can help me? I want to have a JavaScript (eventually vbs) that auto generates a new merged document. If I play the script, Step 1,2 & 4 works. But the most important, step 3, doesnt work. I hope, someone can give the correct code. Thanks!

//OpenDocument.jsx
//An InDesign CS3 JavaScript
//Step1, Opens the document.
var birthDaycard = app.open(File("/c/document/birthday.indd"));
//Step2, Select data
var dmg = birthDaycard.dataMergeProperties;
dmg.selectDataSource(File("/c/document/birthday.txt"));

//Step3, create merged document
var dmd = verKaart.dataMergeOptions;
dmd.createNewDocument;

//Step4, ready
alert ('Done!');
This topic has been closed for replies.

24 replies

Participating Frequently
February 19, 2008
hi olav can you help me please,my project is to merge the .csv file with .indd (indesign file) and produce final merged document as .indd file my email address is sunilkumarrajup@gmail.com
Participating Frequently
February 19, 2008
hi olav can you help me please,my project is to merge the .csv file with .indd (indesign file) and produce final merged document as .indd file
Participant
January 25, 2008
Hi Olav,

Your idea was not totaly correct but it works now :)

All code of step 3 must be deleted, and the code after step 2 is:

dmg.mergeRecords ();

Thanks!
Known Participant
January 23, 2008
Hi Hendrik,

After "dmd.createNewDocument", add:

birthdDaycard.dataMerge.mergeRecords();


"createNewDocument", in this case, is a property, not a method. When you use the mergeRecords() method, InDesign should create a new document containing the merged data. I haven't tested this--I don't have a data file and layout on hand to test with--but I think it will work.

Thanks,

Ole