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 26, 2008
Hi olav ,

thanks for helping me,sir i will clearly explain my project ,
1) first I will have .csv data ,and then I have to merge with .indd and after that I should covert it in to pdf document .all this process should done in single javascript.and I should run in the Adobe Indesign Cs3 Server. Iam running scripts in Adobe Extended Tool Kit.
Can you give script for my project.waiting for your reply.
Participating Frequently
February 26, 2008
hi olav thanks for reply,i have given correct paths,and at last i given a new location to save the output.but even then iam not able to merge these documents,and iam not getting the output as .indd.now just see how iam doing ,i have created a .indd file depending upon my .csv data file using indesign cs3 desktop,how iam creating means,i opened a new document and i went to automation -> datamerge ,then i selected a selected a datasource ,which i selected a .csv data then i created placeholders depending upon my .csv data,then i drag a items of the .csv data in to indesign document and i saved the document and closed.then i i opened in the extened tool kit then i have given paths for these two data item(.csv, .indd),then i run the script,but iam not getting the merged document .indd.even i have given seperate output path.can you please tell me where is the problem and how to solve it ,waiting for your reply.
Known Participant
February 25, 2008
Hi sunilkumarrajup,

It should run on InDesign server. Are you sure that the file paths you're providing are correct?

By the way--the script shown above does not create a new file. It just fills in the placeholders in the template file. If you want to create a new file, you'll have to save the file to a new location.

Thanks,

Ole
Participating Frequently
February 25, 2008
olav the above sscript can run on the indesign cs3 server,please can you tell me that,why beacuse iam using the above script in indesign cs3 server.can you please tell the above can run on indesign cs3 server or not.
Participating Frequently
February 22, 2008
hi everyone when run the above script iam not getting output file as .indd,but iam getting output as .idlk file which is indesign lock file.so please help me to get the output file as .indd in the above script
Participating Frequently
February 21, 2008
olav thanks for reply,when i run script ,it is running but iam getting output file as .idlk file with 0kb,so please help me to get output file as .indd document.so that it can useful for me olav.
Known Participant
February 20, 2008
Hi sunilkumarrajup,

As I thought--it's already been answered earlier in this thread. To save you the trouble of going back and reading the earlier posts, here's a script that does what you want:

//DataMerge.jsx
//An InDesign CS3 JavaScript
//
//Performs a data merge given an InDesign template
//file and a data file.
main();
function main(){
//You'll have to fill in valid files names on your system
//for the data file and the InDesign template file.
var myDocument = app.open(File("/c/DataMerge/DataMergeExample.indd"));
var myDataSource = File("/c/DataMerge/DataMergeExample.csv");
myDocument.dataMergeProperties.selectDataSource(myDataSource);
myDocument.dataMergeProperties.mergeRecords();
}

Thanks,

Ole
Known Participant
February 20, 2008
Hi sunilkumarrajup,

Please stop posting the same question. I will delete repeated posts, and further abuse of the forum will get your account banned.

Someone will answer you when they have time to do so. You are not guaranteed an answer, and repeated posts make it less likely that you will get an answer.

You should also look at the code posted earlier in this thread--it's probably very close to what you need.

Thanks,

Ole
Participating Frequently
February 20, 2008
hi anyone can please provide me the javascript to merge the data of .csv with .indd file and generate a new .indd merged document.so please anyone can help me .waiting for ur answers
Participating Frequently
February 20, 2008
please jongware can you please provide me the script for my application.