Illustrator Scripting :: Access Graph Data Through Scripting DOM?
May 6, 2012Can you access graph data through the scripting DOM?
View 3 RepliesCan you access graph data through the scripting DOM?
View 3 RepliesWhen writting scripts to Photoshop I can use the app.runMenuItem() method to acess commands in the menus. For example: app.runMenuItem (charIDToTypeID("ZoomIn")) will run the Zoom In command.
Does Illustrator have any such method (or accepts anything like action description) to enable us to acess it´s menu items? For example acess Expand comnand, or Object > Live Paint > Make..
Is there a way in javascript for AI to access the pathfinder tools?
If I were using the actions it would be SELECT ALL - PATHFINDER/MERGE.
I am using Javascript for a good amount of other batch processing and it would be great to just have one process.
I'm try to automate the importing of the Varaible and datasets into my graphs via Scripting, but the ImportVaraibles() function doesn't seem to work. Here is my Script, mostly copied from the example script provided with Illustrator (CS5). And, this works manually, using the file names in the script, via Load Variable Library
Set appRef = CreateObject(strIllistratorVersion)
'Open the file and import the datasets
Set docRef = appRef.Open(strTemplate & "200-500.ai")
'docRef.Datasets.RemoveAll
docRef.Variables("Yearbook").Delete
Here is the problem, after I delete the previous library, then this next line, right from the example, does nothing
The script then exits with 'No Datasets in this document'
docRef.ImportVariables (strXMLFolder & "Lumber_200-500.xml")
'appRef.DoJavaScript "alert('Template:" & strTemplate & strRange & ".ai | XML file:" & strXMLFolder & "" & objFile.Name & "^')"
If (appRef.Documents.Count > 0) Then
Set docRef = appRef.Documents(1)
[Code]....
If I remove that delete line, the script runs, but just uses whatever Variables I had last loaded, not the XML file.
It's simply not loading. What do I need to do to get it to load?
Is there a way to access text boxes in an existing document and replace them with a new value taken from an excel table? I've been able to create new documents from scratch and populate them with excel data, but formating these new documents to look like those we already made is proving more difficult than I thought using just Javascript.
Ideally I'd be able specific an index for each text box and replace them in order as i itterate through the excel(or CSV) document.
I already have a way to pull from the table, another question asked here, but can't figure out the object model to put the new info in a specific place.
Below is what I came up with to create a very rough looking document from scratch:
#target Illustrator
var csvFile = new File('C:/users/whatever/spreadsheet.csv');
if(!csvFile.exists){
alert('notafile');
app.quit(); }
[Code].....
I would like to open a file dialog box seltect a CSV text file saved from Excel and import this into an array/variable/dataset in adobe illustrator using javascript. Have done some work with javascript but not a power user. Can't work out how to get the open dialog to appear.
Long term aim would be to use the data to plot a path which seems straighwforward enough, its the getting the info in bit I'm stuck on.
You do have to be able to select the file to import, this bit quite important.
What would be the best strategy on the usage of data set to translate our product packaging. It's quite complex as we have several languages on the same packaging. Moreover, we have different text sources that would require to be translated in different sets of languages.
I have already looked into the data set and I tried to get familiar with it. How to create the data set and how to name the different variables knowing that there are different source texts for a particular region (region means a set of languages) and other texts for another region... The idea is to export this into one XML file with well identified elements that can be split with a tool, sent for translation according to their region then merged back into one single file to be imported back into illustrator
Region 1:
en-US
text 1
text 2
fr-FR
text 1
text 2
de-DE
etc...
Region 2:
en-US
text 3
text 4
ru-RU
text 3
text 4
Region 3:
etc..
It seems that the formatting such as bold, italic and so on is not exported into the data set which is quite embarrassing.
I was wondering if there was a way to import excel datat into illustrator, then it populates a vector pie or bar chart for me?
[URL]
When I insert new data on an existing graph (for example, just adding a new year of data) and press insert, it just deletes the graph entirely. My only option is to recreate the entire graph which is frustrating because I lose its format and colors.
View 4 Replies View RelatedI was wondering if there was a way to extract data from Excel to be used in Illustrator. I know there is an option of variables and xml, and I don't want that. I've seen and tried out how to read illustrator and write to excel, and I get that. What I would like to do is pretty much the opposite:
1.Pre-fill in an Excel file(.xls,.csv, doesn't matter) with data such as a filename in column 1 and (Replacement Text) in column 2 and close manually.
2. Run script(VBSCRIPT,Javascript, doesn't matter)
3.For each column in Excel file where cell in first column is not empty, open Illustrator Template with placeholder of "DWG" textframe and replace the frame titled "DWG" with Replacement text from Excel in Column2.
4, Save each to a PDF file and name file with text from Excel Column1(Filename)
In a nutshell, there will be a single illustrator template with a premade textFrame with a name of "DWG". Excel will contain two columns, one for the filename to be named and one for the relative text to replace with the placeholder in AI.
Automated AI so much so that it can read instructions from an external source like xml or txt and automatically creates files and folders.
For example we have something like this:
File1
Hello
Font: Myriad
Size: 22
Colour: Pantone 254C
Image 1.jpg (link)
Source: Image1.png (link) clipart1.eps (link)
----------
File2
and so on.
I want AI CS5 to:
1. create an eps File1, create a folder named File1, put File1.eps in it
2. type the text Hello, apply Myriad 22pt and PMS 254 to it, centre it to the artboard
3. Place all jpegs, pngs, eps source files on the artboard and embed them.
4. Save the file as eps legacy version 10, close the file and move to the next file.
I want to send the contents of A1 to an Illustrator document at 135, 172 and B1 to 135,190, same with A2/B2 will be at different coordinates as will A3/B3 and so on... I want to do this 6 times and save the document as a PDF. Then, it should clear and do it again. The columns will ALWAYS be A and B.
View 5 Replies View RelatedProblem:
How to read real number data from selected columns in an Excel spreadsheet into an illustrator javascript array variable, so that then I can use this information to construct an illustrator polygon.
Further information:
I am new to javascript (and not much of a programmer in the best case, but do have some basic knowledge using ancient languages like FORTRAN 88). I am sure I am just missing an important step here despite all morning browsing with Google for answers (something to do with variable definition I assume?). I have some survey data defining the outline of features in map view listed in a string of point (x,y) values in adjacent columns in excel (these x,y point values calculated from GPS data using a commercial program to converted 3D position to a 2D x,y by geoid projection, and then in excel to re-scale point locations to illustrator’s artboard). What I am trying to do is select columns of x,y value pairs in an excel spreadsheet, copy these values to the clipboard, and then develop an IA JavaScript to draw a polygon through the specified set of x,y points. It seems easy enough to script illustrator to draw the polygon once I get the values from the clipboard are in a javascript array (lots a good tips here [URL] ....), but pulling in the clipboard data seems to be beyond me. I have tried populating a defined array with various combinations of array declarations and app.paste(); or windows.clipboardData.getData('text/plain'); with no satisfaction. I then had the idea to try to pull in the clipboard to one long continuous string, place that in a text box (see see its structure), andthen read and split up the text in a loop to populate the JavaScript array…but that deposited a complex illustrator table object into my text box, and several attempts to force the clipboard to paste text did not work (again probably having problems understanding variable type declaration).
I would be happy to find any method of scripting the pull of the selected on an excel spreadsheet for use in an Illustrator script…so if I am making this all harder than it needs, be I would be grateful to know that also!
the Script of creating mirror text and stroke text in Adobe illustrator scripting.
View 4 Replies View RelatedWhere I can find the button to add data labels to a column graph?
These are the numbers/percentages that appear at the top of the column once it's been generated so you can see that is was say 50% or 60%.
I'm laying out a report with many graphs of similar styling, the client is to provide an Excel doc with the figures and I need to redraw them as graphs.Is it possible to design the graph style in Illustrator, import the data from the spreadsheet to the graph and then place the graph(s) into InDesign. Essentially, this is what I'd like to achieve:
1) Style/design a graph in Illustrator
2) Import spreadsheet data into Illustrator graph (a step I'm also haveing problem with - is it possible to import an entire Excel doc or do you have to copy and paste each cell individually)
3) Import Illustrator graph into Indesign
4) If original data in Excel is changed/updated and the document is saved, data will update in Illstrator and therefore in InDesign.
I create pie graphs in illustrator for a financial sevices group. Every month when I update the data the format and colour of the graph distorts. I am spending too much time manually fixing the graphs.
View 3 Replies View RelatedHow to get data values to display inside the columns on a column graph?
View 2 Replies View RelatedIn a new Illustrator file, I select "Object...Graph...Graph Type" and make sure I have pie graph selected. Then I draw the circle I want to be a pie graph, make sure it's selected and choose "Object...Graph...Data" which opens the graph data entry "spreadsheet" but the text box and buttons on the top are greyed out and there are no visible cells. If I move the pointer around inside the window, it does become the "row/column" resize pointer as if there are cells present but disabled.
View 1 Replies View RelatedI need to make some graphs that are linked to a series of data through XML files (originally Excel) and create an indvidual document for each data set. They will be used for the web and print.
View 2 Replies View Relatedthe rows/cells disappeared for my data in a bar chart in Illustrator CS5.5.The first number shows up but then I have to keep hitting tab but they are not divided into visible cells any longer.I usually see rows and columns like in Excel.
View 2 Replies View RelatedQuite new to Ai's scripting stuff.
I'm having a complicate time with Ai's save to jpg options vs artboard sizes and units conversions.
Say, i have a doc (from my client), which they inherited and enhanced for 10 years may be.
It's "supposed" to be in millimeters, but artboardRect gives me those values :
-0.27880000000005
436.191388980878
646.457
-0.20900000000074
which sound like weird points or pixels.
I need to export a jpg (or gif, or png), that will be X pixels wide. For the purpose of the test i set it at 1200.
var maxLargeurPx = 1200;
First thing, getting the artboard's width :
largeurArtboard = Math.abs(thisArtboardRect[2]-thisArtboardRect[0]);
// 646.7358
Then i try to have a multiply factor to use
coefExport = /*Math.round*/ (100 * maxLargeurPx / largeurArtboard);
// 185.54717397738
and then set my ExportFile jpg to this value (i can't give it a number)
// exportOptions.horizontalScale = coefExport
That's when it's getting fun : my images are 1204 px wide with or without clipping.
Of course, i "can't" resize the doc for each export, especially expecting to have dozens of those, with different values, dimensions, etc.
I wrote the following AppleScript to open a PDF file and export is as PNG. I am using Illustrator CS5.
The export command gets an error: Adobe Illustrator got an error: Can't get current document.
when it encounters the export command.
set inputFile to (choose file with prompt "Open PDF file to convert to PNG:") as text
set exportFile to inputFile & ".png"
tell application "Adobe Illustrator"
if not frontmost then activate
open inputFile as alias without dialogs
export current document to exportFile as PNG24 ¬
with options {class:PNG24 export options ¬
, resolution:300 ¬
, matte color:{red:0, green:0, blue:0}}
close current document saving no
end tell
Im trying to add a pdf on top of an existing PDF in illustrator using a script. This is supposed to be done by anyone at my firm so that is why I want it in a script. I also have a lot of other functions that works that will do some other stuff with this document.
Created this from the scripting guide but it doesnt work. Im pretty sure its the embedDoc var thats empty and i dont understand why. Im not sure if the File "points" to the directory of the script or the original file but Ive tried both ofcoarse.
This is the masterpiece
var embedDoc = new File("/temp/testfile1.pdf");
if ( app.documents.length > 0 && embedDoc.exists ) {
var doc = app.activeDocument;
var placed = doc.groupItems.createFromFile( embedDoc );
}else {alert("suck")}
Is it possible to reference layers or groups by their names instead of their index using VBA? If so, what is the sytax? I know you can do it in Extendscript, but I'm not finding info for VBA.
View 7 Replies View RelatedIllustrator can make graphs with lines and bars / columns, for example from the docs: [URL] .....
However, when I create a graph like this, I seem to lose the ability to manually set the value axis using "override calculated values".
To reproduce this problem: Create a graph like the example, with bars and an axis on the left, lines and an axis on the right. Unlike the example, don't fix the numbers so the lines match up neatly - have one side go up to just under 20, one up to just under 250, so there are mismatched markers and numbers of divisions on each side.Try to make the markers and numbers of divisions match up, so the side that goes up to 20 actually goes up to 25 and has the same number of divisions as the other side.Everything I've tried doesn't work:
If I select the whole graph and go to 'Graph Type', I can't set Value Axis options. In earlier versions it's greyed out, in CS6 I can access it but clicking 'Okay' does nothing.If I select the whole graph and chose one graph type, I can set the Value Axis options, but that selected graph type then applies to the whole chart,If I use the Group Selection tool to select one of the series, and open 'Graph Type' options, changing the Value Axis options has no effectIf I use the Group Selection tool to select all series that share an axis and open 'Graph Type' options, changing the Value Axis options still has no effectIf I use the Group Selection tool to select the axis ticks group itself, or the axis line and axis ticks groups themselves, or the axis labels, axis line and axis ticks, or the axis labels, axis line, axis ticks and associated data series, etc, changing the Value Axis options also has no effect
It seems like this feature is broken and it seems like the example in the manual was carefully chosen to use a rare combination of numbers where it would actually look right.
Swatches Swatches Read-only. The swatches in this document.
Deletes a swatch from the current document
Set appRef = CreateObject("Illustrator.Application")
Set documentSwatches = appRef.ActiveDocument.Swatches
Set swatchToDelete = documentSwatches(5)
swatchToDelete.delete
How am I supposed to be able to make changes to the swatches collection - it is read only...
Not supprisingly I have failed to implement this in C-sharp
I am trying to close alert at once but the loop continues the alert, how can I stop the alert at once
var doc = app.activeDocument
var layersToTargetNameArray = ["Background", "Artwork", "diecut", "size", "sign off panel"];
for (var i = 0, il = doc.layers.length; i < il; i++) {
var curLayer = doc.layers[i];
[Code] ......
Is there anyway in JavaScript to replace one swatch with another?
I've seen other posts where similar questions have been asked, but the solution seems to involve iterating over all the pageItems, testing and then changing the fillColor.
All I want to do is delete/replace a specific color. Say replace Yellow with Green.
Is there a way of doing this without recursing through all of the page items?
I added CS6 COM reference in my VB.NET application and after that I have the following basic object creation in order to convert a eps file to svg. But for some reason when I create this COM object it is launching the Adobe Illustrator application. Why it is doing like this? It’s a simple COM object why it is interacting with Illustrator Editor?
View 9 Replies View RelatedI'm working on a script with an UI element. I want all values of the 2. cloumn (Rasterkeilfarbe) returned in one array and all values of the 3. column (Klischeenr.) returned in another arry.
var farben = ["black", "red", "blue", "green", "bla", "blupp"]
var myName = myInput (farben);
// rest of the script
[Code]....