Batch Saving Data Sets – Illustrator Error on Data Set Change

I am trying to update all the Data Sets in my Illustrator document so that when I do a Batch Action Save I don’t get the following error:

The current values have not been captured and will be discarded upon switching data sets. Proceed?

I found this StackExchange answer here, but this script is not working on my Illustrator when I execute it from the File > Script > Other Scripts menu.

Here is the code:

function cycleUpdateAllDatasets(doc){
for(var i = 0; i < doc.dataSets.length; i++){
var d = doc.dataSets[i];
d.display();
d.update();
 };
};

I am not very familiar with javasript so I am not sure why the script isn’t working and was hoping someone could shed some light on this?

I am on the Adobe Illustrator CC

Answer

The complete code is:

#target illustrator
function test () {
  var doc = app.activeDocument;
  function cycleUpdateAllDatasets (doc) {
    for (var i = 0; i < doc.dataSets.length; i++) {
      var d = doc.dataSets[i];
      d.display();
      d.update();
    };
  };
  cycleUpdateAllDatasets(doc);
}
test();

Attribution
Source : Link , Question Author : Kasandra Murray , Answer Author : Silly-V

Leave a Comment