Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with JS data merge script

Status
Not open for further replies.

DavidRock

Programmer
Jul 24, 2002
61
US
InDesign CS with PageMaker plugin on Windows.

Using the JS data merge example from the scripting addendum, I'm able to merge all records into my document. But I don't understand how to only merge a single record. I included the script I'm using below. The addendum indicates I need to use RecordSelection.oneRecord and recordNumber to do what I need, but everything I've tried only generates errors, mostly "undefined is not an object". Can someone show me how to set those properties in this JS script so that I can merge any record I want?

current script:

if(app.documents.length != 0){
var myDocument = app.activeDocument;
app.dataMergeOptions.removeBlankLines = true;
// app.dataMergePreference.RecordSelection.oneRecord ???
//Select a source file.
var myDataFile = File.openDialog("Select a data file")
if(myDataFile != ""){
myDocument.dataMergeProperties.selectDataSource(myDataFile, DataSourceType.commaSeparated);
myDocument.dataMergeProperties.mergeRecords();
}
}

Thank you in advance to anyone who can help me out.
David Rock
 
If haven't done so already, I'd recommend taking this to the ID scripting forum on the Adobe web site.
 
I have a thread started on Adobe's scripting forum also. Unfortunately, I'm beginning to conclude that there isn't anyone who frequents the forums who has scripted a data merge using InDesign and JS. Adobe support indicated they can't answer scripting questions, even ones to clarify syntax found in their guide.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top