0 Replies Latest reply on May 13, 2013 6:29 AM by nsc_remco

    InDesign [CS6][JS] DataMerge

    nsc_remco

      I'm trying to use Javascript to do a datamerge in InDesign. So far I'm able to have a file dialog to browse to my tab delimited txt file and have that loaded as my data source. I'm also able to set options for "DataMergePreference".

       

      main();
      
      
      function main() 
      {
      
      
      var myDoc= app.activeDocument;
      var myDataSource = File.openDialog("Please select a datamerge source", "Text files:*.txt");
      
      
      if (myDataSource != null) {
          myDoc.dataMergeProperties.selectDataSource(myDataSource);
          myDoc.dataMergeProperties.dataMergePreferences.recordsPerPage = RecordsPerPage.MULTIPLE_RECORD;
          }
      
      }
      

       

      What I would like to achieve is being able to have full control what datamerge field goes where, but after the code above I have no idea to to proceed (I'm a coding newbie). Anyone that could point me in the right direction? I know there's a reference library online at http://jongware.mit.edu, but I'm really struggling with interpreting the correct syntax.

       

      Thanks in advance!

      Remco