Illustrator Scripting :: How To Read Real Number Data From Selected Columns In Excel Spreadsheet
Oct 27, 2013
Problem:
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!
I'm using the variables panel in Illustrator to pull a data set I've got.
For example there's 2 text variables and 1 number going from 0-359. I'm looking for a script which looks at the variable name and pulls the number, then uses that number to rotate a shape by that many degrees.
I've written a script to allow you to select an image to replace any number of selected files. Each file starts out as an embeded image with a .note to determine where the basis of alignment for the new file should be (i.e. "top," "bottom," "left," "right"). You'll find the code below:
#target illustrator
if (app.documents.length > 0) { var docRef=app.activeDocument; var docSelection = docRef.selection; // ** Get new file
[Code]...
For some reason, the ".note" added at the end of the script gets erased once the script is complete. I can even get it to confirm that it applied the note to the image, but once it's complete, it's gone.
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 would like to be able to export the description column of a BOM to an excel file, and exclude all the other data. I can't see any reference to doing this in the API. We have almost 20 columns so deleting them once the file is made is a bit of a pain.
I 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.
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.
I need to find a way to export my BOM data to an Excel spreadhseet. Some of my BOM's are in tables, most are not. I found a lisp routine that will export this data to a csv file, but it's clunky at best. I don't want to use the "ole" method, I don't feel like fighting that battle.
So outside of plotting to a "png", and pasting that into Excel, are there any other options that are feasible?
I have a map in AutoCAD and I would like to fill certain sections of it. The colour that I require the fill to be changes according to varying data in an excel spreadsheet. Is there a way of linking the two?
example [CommandMethod("Test")]public static void TestMethod(){ Document doc = Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; Database db = doc.Database; using (Transaction Tx = db.TransactionManager.StartTransaction()) {
[Code]...
1-autocad program will be closed 2-be selected within the file path c sharp example: csharp.jpg 3-I want to read data from a DWG excel file using C#. examples: dwgfile.jpg and drawing1.dwg 4-I want to list here DataGridView data 5-c sharp winform .net 4.0
I have a document that I would like to import an Microsoft Excel spreadsheet into.
Basically, my document is a diploma that can range anywhere from 15-250 different names and corresponding dates with those names. It would save a great deal of time if I didn't have to manually type the names and dates into their respective spots.
I have a Microsoft Excel spreadsheet that if possible, I would like to autofill the information into the Illustrator file.
Between the second & third lines of text is where I would like to enter the first column of text. It would be NAMES that go here.
Then, between the fifth & sixth lines of text is where the second column of text from my spreadsheet would go. This area would be filled with dates.
the 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.
I'm trying to read a text file into a textFrame. It reads in but is not including linefeeds so it's just one big long line of text. I'm using the following code to read the file. I attempted to insert a character after each readln() but that didn't work. I also tried creating a variable that the readln() was stuffed into before setting the textFrame.contents to the variable, but that didn't work either. I'm stumped.
while (! notesDoc.eof) { noteTextRef.contents += notesDoc.readln();}
How do I read input parameters from a script file name? For example, let’s say I want to run a script that requires 3 variables as input, but rather than prompting for the values I wish to read them from the script file name … e.g., the file name might be “Myscript.js (my_variable1, my_variable2, my_variable2)” … where variables are all real numbers. So I assume the script name when run should look something like … Myscript.js (10, 10, 100), but how do I then read these and assign these values to a var statement within the script?
Is it possible to use an imported text as a number? I would like to import a .txt tab formatted file containing some values (ex: 22.5; 50.00; 150.00, etc.), and I want to treat those values as numbers in my script. Is this possible?
Code snippet to show me how to iterate through the selected text (not the frame!, not the words, only the selected chars) and make any change on the characterAttributes (size, color, etc.)?
In the property "app.activeDocument.selection" usually the selected objects are stored as an array. Now when I select characters in a textframe (or TextPath, whatever) there is a [Textrange] in it. I already tried some combinations like this snippet underneath but I still get errors, that selectedChars[i] is undefined.I'm on Illustrator CS4, Mac OS X, Javascript
var selectedChars = app.activeDocument.selection.characters; for (i = 0; i < selectedChars.length; i++ ){ selectedChars[i].characterAttributes.fillColor = myNewCMYKColor;
is there a way to get position of any selected object? It seems like normally you have to dive into specific item like textFrames to get position, but was curious if there was a generic way of doing this for selected objects.
I am searching for a simple automated Find and Replace script, the idea is that in Excel the Find and Replace with texts are located. The script finds the textblock in Illustrator and replaces it with the value from Excel "New number".
I have an excel file with thousands of rows, each with a column for the x-coordinate, the y-coordiante, the height, and width of a rectangle. I need a script that will ask me to select the excel file, read the excel file, and create rectangles from each of the thousands of rows. I'm working in a windows environment and have Illustrator CS4. Any scripts out there that might give me a start?
I'd like to draw a box around some selected text (a textRange), however I can't figure out how to detemine the size or position of the text. The overall size of a textFrame is possible to find (not sure about position), but when you've got just a few characters selected I don't see any way to get the size or position.
Simple solution to aligning selected items to the artboard. I was going to create an action but then realized it would be more convenient for me to include it in my script file....I have a script to align objects with each other but they dont align to the artboard.
It is possible to apply the Convert to Grayscale(Edit->Edit Colors->Convert to Grayscale) for the selected items in illustrator cs3 in script (javascript)?
When I run the script for an object selection, I want each object to have its color set to the underlying color as if I had used the eyedropper tool. Is this something that can be scripted?
How can I get width that multiple selected items? (Not grouped.)
//---------- source code ---------- var mm = 2.83464566929134 //unit conversion. (point->milimeter) var W = docRef.selection[0].width/mm; alert(W); //---------- source code ----------