Adobe Illustrator and Graphs

Hi all

Been a while since I’ve come on to here. It looks so nice, love what you’ve done with the place.

I am trying to create an end-to-end solution to create some graphs in Adobe Illustrator from an Adobe Analytics project. It’s a matter of licensing costs for us. I can export my data from AA, drop it into a hot folder, parse what I need and store as a .csv file.

I am struggling with figuring out how to get that data into a content variable in AI.

I will be working with the same graph, just modifying its data, exporting it as a .png, then repeat until I have all the charts I need. I thought content variable was the way to go and probably still is it is just my own limitations.

I have the file set. Here’s my rudimentary script to access it:

tell application "Adobe Illustrator"
	--Create a new document
	set docRef to current document
	tell docRef
		set arrGraphItems to every graph item
		set myGraph to first item of arrGraphItems
		
		tell myGraph
			set name to "AA Test"
			
			-->let's make a new content variable
			set contentVar to content variable
			log contentVar
		end tell
	end tell
	
end tell

The log shows something:

(*variable aa-data of document 1*)

But, if I am reading this correctly, the content variable has no properties, it is just a property of something else.

How do I get data into the content variable? Or how do I get the content variable to read data?

Thanks in advance!

It is likely the property of a graph item or graph item object properties.

Maybe start with something like this:

set graphItems to every page item of document 1 whose class is graph item

FWIW, I would avoid layering all the tell statements until I had the heirarchy nailed down. Just use the tell application… block and then spell everything out inside that.

Thanks, I’ll give it a go.

I didn’t read your reply that closely at first.

Yeah, that’s what my code is doing, pulling the content variable property of the graph, but how do I pass values into the content variable object? It has no properties.

The content variable is a property of a graph item.

The data within it is apparently a ‘dataset’. Looks like a dataset is a property of a document.

Maybe you could get that with a command like this:

dataset 1 of document 1

I don’t have illustrator… I’m just trying to make sense of some documentation.

Here is a page in the docs that I’m looking at:

Dynamic Objects

This is a handler from a long script that, among other things, creates a graph show the last six months of the Dow Jones average’s closing value.

I think this line:

  import variables of myDoc from todaysXMLfilePath

may be what you need.

on DowPopulateIllustratorChartXML(todaysXMLfilePath, chartDoc)
--chartDoc is an alias for the day's chart
--todaysXMLfilePath is an alias to the file containing the day's data in XML format
 
 --six months = 126 days
   tell application "Adobe Illustrator"
       open chartDoc
      set myDoc to document 1
       import variables of myDoc from todaysXMLfilePath
      
      set theDataSets to datasets of myDoc
      set currentDataSet to dataset 1 of myDoc
      tell myDoc to display currentDataSet
      set dataSetName to name of currentDataSet
      my DowSetDotPosition() --Places a dot graphic on the chart
      my DowFixMonthBoxes() -- Populates the label boxes below the chart
      set dowClosingText to dowClosingValue as real
      set dowClosingText to my FormatNumber:(dowClosingText) byPattern:"#,##0.00"
      
      tell myDoc
         set contents of page item "DowClosingBox" to dowClosingText
      end tell
      
   end tell
   tell application "Adobe Illustrator" to save document 1 in dowChartDocPath with «class pRpl» -- Should be with replacing, not sure why that's not displaying
   
   set charteps to my SaveAsEPS(dowChartepsPath) -- call handler to save EPS
   tell application "Adobe Illustrator" to close document 1 without saving
    
end DowPopulateIllustratorChartXML