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
I would greatly appreciate any help you, dear reader, can give me on this.
Well, did you look at the dictionary?:
merge recordsv : Merges records and produces an optional overset report.
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.