Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Illustrator scripting with datasets & variables

New Here ,
Nov 05, 2008 Nov 05, 2008
I have a .ai file with 3 datasets containing 2 variables each. I am new to adobe scripting and am trying to write a script that will loop through the 3 datasets, swap out the variables, and save as 3 different .pdf files. I can loop and export, but don't know how to access the variables.

Here is a snipped from what I have:

for (var i=0; i< docRef.dataSets.length; i++){

var ds1 = docRef.dataSets.getByName('ABC'); // ABC is a client name, but numeric index is required
//var ds1 = docRef.dataSets.index(1); // this doesn't seem to work, but i need it to
docRef.activeDataset = ds1;

// I need to access the dataset variables here, where ClientName is a variable name within the dataset
client_name = ?????;

ds1.display();
app.redraw();

// ----- save changes
filepath = '/Users/me/Documents/clients/'+client_name+'.pdf';
saveInFile = new File( filepath );
pdfSaveOpts = getPDFOptions( );
docRef.saveAs( saveInFile, pdfSaveOpts );
}

Thanks for any help
TOPICS
Scripting
2.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
LEGEND ,
Nov 07, 2008 Nov 07, 2008
Are you aware that you can do that with an Action in Batch mode, and avoid resorting to scripting?

JET
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 11, 2008 Nov 11, 2008
LATEST
markr34,

I have never done any dataset scripting, but my eyes tell me that at this line:

//var ds1 = docRef.dataSets.index(1); // this doesn't seem to work, but i need it to

you'd probably want to use square brackets [1] rather than parentheses to refer to array by index.

HTH
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines