Using a Script to access InDesign’s DataMerge fields
I’m trying to work on making a script to automate a portion of our work flow and trying to access the content being loaded in via the Data Merge Function. My hope is to be able to access the names of the fields that are loaded in, and then access the items within that field, however i’m having no luck with the script recognizing names of fields. what ive tried is:
app.activeDocument.dataMergeProperties.dataMergeFields.count() – this returns the correct number of fields loaded in
app.activeDocument.dataMergeProperties.dataMergeFields.item[0] – this returns as undefined, and is not an object
app.activeDocument.dataMergeProperties.dataMergeFields.toSource() – this returns ‘resolve(“/document[@id=23]/@data-merge-properties/data-merge-field”)’
app.activeDocument.dataMergeProperties.dataMergeFields[0] – this returns [object DataMergeField]I’m referencing indesignjs.de but so far has not cleared things up, any help would be appreciated!
