2 Replies Latest reply on Jul 17, 2014 3:13 AM by europeanrich

    Script access to dataset variables

    europeanrich

      Hello,

       

      I've added some dynamic text variables to an illustrator file (CC), captured the dataset and I'm trying to access these variable values through scripting.

      Is this possible with the Dataset method or do I need to parse the XML to retrieve info between <Book></Book> etc?

      I've hacked together a perl script to do this, but it's not ideal as I need to then use javascript to call applescript to run the shell script with administrator privileges!

      I'm sure there must be an easier way – any help would be much appreciated. Exported XML file is as follows...

       

      <?xml version="1.0" encoding="utf-8"?>

      <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"    "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd" [

           <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">

           <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">

           <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">

           <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">

            <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">

      <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">

      ]>

      <svg>

      <variableSets  xmlns="&ns_vars;">

            <variableSet  locked="none" varSetName="binding1">

                <variables>

                     <variable  trait="textcontent" category="&ns_flows;" varName="Book"></variable>

                     <variable  trait="textcontent" category="&ns_flows;" varName="Author"></variable>

                     <variable  trait="textcontent" category="&ns_flows;" varName="Year"></variable>

                </variables>

                <v:sampleDataSets  xmlns:v="&ns_vars;" xmlns="&ns_custom;">

                     <v:sampleDataSet  dataSetName="Data Set 1">

                          <Book>

                               <p>Catch-22</p>

                          </Book>

                          <Author>

                               <p>Joseph Heller</p>

                          </Author>

                          <Year>

                               <p>1961</p>

                           </Year>

                      </v:sampleDataSet>

                </v:sampleDataSets>

           </variableSet>

      </variableSets>

      </svg>