24 Replies Latest reply on Feb 26, 2008 3:45 AM by (sunilkumarrajup)

    auto Data merge

      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!');
        • 1. Re: auto Data merge
          Level 1
          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
          • 2. Re: auto Data merge
            Level 1
            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!
            • 3. Re: auto Data merge
              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
              • 4. Re: auto Data merge
                Level 1
                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
                • 5. Re: auto Data merge
                  Level 1
                  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 using javascript my email address is sunilkumarrajup@gmail.com
                  • 6. Re: auto Data merge
                    Level 1
                    Hi sunilkumarrajup,

                    Use the DataMerge plug-in. It's on the Automation submenu menu of the Window menu. You don't need a script for this.

                    Thanks,

                    Ole
                    • 7. Re: auto Data merge
                      Level 1
                      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 using javascript i want to implement in indesign cs3 server
                      • 8. Re: auto Data merge
                        Level 1
                        iam doing in indesign cs3 server,so i need the javascript to merge the data of .csv with .indd file and produce new merged .indd document.
                        • 9. Re: auto Data merge
                          Level 1
                          please olav iam waiting for reply,please provide me the javascript for merging the .csv data with .indd file
                          • 10. Re: auto Data merge
                            Level 1
                            in the below javascript when run the script iam not getting merged document,but it produce a .indl file(indesign lock file)but i want .indd ,so please correct the below code that produce new .indd document.

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

                            //Step3, create merged document
                            //dmg.dataMergeProperties.mergeRecords();
                            dmg.mergeRecords();

                            //Step4, ready
                            alert ('Done!');
                            • 11. Re: auto Data merge
                              Level 1
                              in the above javascript iam not getting the output please edit it send me the correct one
                              • 12. Re: auto Data merge
                                Level 1
                                hi hendrik can you help me with my problem..iam not getting the output when i run it...please correct it.and send me...actually i want to merge the data of .csv with .indd and produce a new .indd merged document.please give me the script for my application its urgent for me.
                                • 13. Re: auto Data merge
                                  [Jongware] Most Valuable Participant
                                  This is an open user to user forum. You are not communicating (as in "mailing") to a single person. As soon as you enter a message here, it's visible for the entire world. Everyone logged in to the forums can see the little red flag, signifying some reply to your original question. If that "reply" is just
                                  i you,
                                  repeating the question, or demanding an answer, or complaining "it still don't work no", more than a few times, the average reader of these forums will loose interest in you and your problem.

                                  You seem to assume this data merge thing you want is a well known trick, and everyone here has "the correct script". You want in, so "we" should send you the script. That's what I'm reading in your pleas, anyway. Not so.

                                  In your desperation, you seem to forget a few basic steps. First is a general background knowledge of what you're talking about. A script that produces an indesign Lock file!? Oh, come on! Your script doesn't work. What error does it give? "It does not work" is not an error message.
                                  • 14. Re: auto Data merge
                                    Level 1
                                    yes jongware it is producing a indesign lock file but i want .indd file to produce.actually my project is to merge data of .csv with .indd and produce new .indd merged document
                                    • 15. Re: auto Data merge
                                      Level 1
                                      please jongware can you please provide me the script for my application.
                                      • 16. Re: auto Data merge
                                        Level 1
                                        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
                                        • 17. Re: auto Data merge
                                          Level 1
                                          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
                                          • 18. Re: auto Data merge
                                            Level 1
                                            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
                                            • 19. Re: auto Data merge
                                              Level 1
                                              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.
                                              • 20. Re: auto Data merge
                                                Level 1
                                                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
                                                • 21. Re: auto Data merge
                                                  Level 1
                                                  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.
                                                  • 22. Re: auto Data merge
                                                    Level 1
                                                    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
                                                    • 23. Re: auto Data merge
                                                      Level 1
                                                      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.
                                                      • 24. Re: auto Data merge
                                                        Level 1
                                                        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.