1 Reply Latest reply on Apr 2, 2010 9:34 PM by John Hawkinson

    Indesign CS3 Data Merge "Merge Records" Command. Help?

    welchp Level 1

      I'm looking to automate the merging of a mountain of records. I have 587 tab-delimited text files with 40 records each. I want to process these via Data Merge using a single pre-designed template with built-in placeholders and variable data fields, including a variable barcode graphic. In the end, I want to create 704 multi-page, 6-up per page, indesign files with merged data, and 704 multi-page PDFs.

       

      Here's where I am at. Using a combination of AppleScript, TextWrangler and InDesign CS3, I am able to set up a loop where I can open the single template, save it to a new file with a new name, change its data source to the appropriate text file, and as a test, make a PDF of the template using the correct export preset. What I cannot seem to do is get the template to perform a "Create Merged Document...".

       

      In InDesign CS3's AppleScript dictionary there is a command called "Merge Records" under the Data Merge section. It appears to do exactly what I am after. But when I try to use it (and the good Lord knows I have tried numerous permutations), it only returns errors like "Adobe InDesign CS3 got an error: active document doesn't understand the merge records message."

       

      Anyone know what I am doing wrong? I have set up a separate AppleScript for testing purposes that opens up the template, saves it under a new name, and attempts a "merge records" command. Here it is. Maybe someone smart out there can tell me what I am doing wrong.

       

      set templatePath to "Welch_Jobs:0_JOBS:280019_Churchill:WPC FILES:Workup:280019_6up_master template.indt" as text -- the main template file that will be modified, saved with a new name, then merged with its data to create a new merge file

      set newTemppath to "Welch_Jobs:0_JOBS:280019_Churchill:WPC FILES:Workup:goody.indd" as text

       

      tell application "Adobe InDesign CS3"

      open file templatePath

      tell active document

      save to newTemppath

      merge records

      end tell

      end tell

       

      I have this feeling that this is a command that is actually unsupported. Google searches have been fruitless except for one poor soul who can't get it to work either. I have, however, seen that a similar JavaScript command exists called "DataMerge.mergeRecords". If it is impossible to do this via AppleScript, is it possible to make a JavaScript that will do it, and access the JavaScript with a "do script" command in the main AppleScript? If so, how would I accomplish this? What whould the JavaScript look like, and where do i need to put it?

       

      I would greatly appreciate any help you, dear reader, can give me on this.

        • 1. Re: Indesign CS3 Data Merge "Merge Records" Command. Help?
          John Hawkinson Level 5

          Well, did you look at the dictionary?:

           

          merge recordsv : Merges records and produces an optional overset report.

            merge records

          data merge
              output overset report file alias or

          text] : The path to the file in which to store the overset report.

           

           

          Note also that it's part of the Preferences Suite, not the Datamerge suite. Do you see differently?

           

          Anyhow, you're clearly not calling it with a data merge parameter.

          I also have a suspicion that it needs to not be inside a "tell active document" but it probably doesn't matter.

           

          But my AppleScript is rusty.