Illustrator Scripting :: Read A Number From A Variable And Rotate A Shape

Jul 26, 2012

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.

View 2 Replies


ADVERTISEMENT

Illustrator Scripting :: Adding A Number To A Variable

Feb 3, 2014

I am trying to add a number to a variable.  var n=y+36...So I am creating a new variable (n) whose vaule is 36 points more than the variable "y".

View 5 Replies View Related

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!

View 4 Replies View Related

Illustrator Scripting :: How To Automate Importing Variable And Datasets Into Graphs Via Scripting

Dec 18, 2012

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?

View 8 Replies View Related

Illustrator Scripting :: Passing Variable Via BridgeTalk

Jan 9, 2013

I now understand about serializing the message, and loading and running external scripts via opening, reading, and sending them within the context of BridgeTalk. 

I have a palette window which contains a listbox of items that searches and lists the contents of over 400 products. This pic of the template below is typical for all items.  The imprint area shown will change depending on the product.
 
Script #1:
When the user selects a product from the list, that selection is used to open a file (illustrator template) for that item that shows a guide path box  with height and width information for the imprint area on the product.  The currently opened illustrator document contains the artwork they are working on at the time.  This artwork is copied and pasted to the newly opened template file.
 
Script #2:
This script contains  an array of all the products in the palette list.  Within each index of that array, each item will contain the following information:
 
Example (the name property of each item will match the name of the index box selection from script #1):
 
var itemArray = new Array();
//p may be saved at index 0 of itemArray
var p = new Object();
        p.name ="P- Shape P";
        p.width = 189;
        p.height = 103.5;
        p.pos = [300,564];
 
I need to send the selection from script #1 to script #2 so I can loop through the array and find a match, at which point the information stored in the properties of the item will be used to scale the art and place it in the correct position on the template.  Is there any way to send a variable from script #1 containing the name of the selection via BridgeTalk and have it stored in a variable in script #2?  If not, I read somewhere where it might be possible to write/save it to disk and have the second script read it. 

View 8 Replies View Related

Illustrator Scripting :: Variable Width Tool (JavaScript)

Feb 6, 2013

I am looking for any info on scripting the Variable width tool (Javascript).
 
Background: By adding a gradient to a variable width strock you can create nice 3D looking  Shapes (see example)

this is a straight vertical line with varied widths, then hit with a gradient.
 
Goal: My hope is to write a script that will take a "Profile" or "Shape" and convert it to a Variable width line. (see Example)

The Black line is to have its widths modified
The Red line is how wide the line needs to be.

View 10 Replies View Related

Illustrator Scripting :: How To Read Text File Into TextFrame

Feb 23, 2012

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();}

View 2 Replies View Related

Illustrator Scripting :: Read Input Parameters From Script File Name

Aug 24, 2013

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?

View 3 Replies View Related

Illustrator Scripting :: Evaluate If A Number Is Even Or Odd?

May 15, 2013

I have to write a loop statement wich has to be able to identify odd numbers from even numbers:

View 2 Replies View Related

Illustrator Scripting :: Rotate Whole Document Page In Vbscript

Apr 19, 2012

in an open PDF File  i press 'Ctrl+A' to select all Items in the document, then i choose Edit/Transform/rotate ... 90 degree.now i'd like to do the same with an vbscript.
 
the best thing i could find is:

rotate(90)
Sub rotate (degree)
Dim appRef, argument, element
Dim changePositions, changeFillPatterns, changeFillGradients, changeStrokePattern, rotateAbout
Set appRef = CreateObject("Illustrator.Application")

[code]....
 
not all, but all elements i am interested in are rotated - it would be better if really all elements would be rotated the elements are rotated around 'aiTransformDocumentOrigin' ... i would prefer if they are rotated around 'middle of document'.

View 3 Replies View Related

Illustrator Scripting :: How To Get Similar Transforms With Rotate And Translate

Nov 5, 2012

I want to get similar transforms with rotate and translate as I get it with the Transfommation Effect on multiple copies. But somehow the rotation of the Filter puts a different transform than doing it with rotation in js. With js the copies get rotated around a center, that is on the same level for all objects. With the filter the translations seem to have an different origin/direction. I dont get the logic how to get the same output with js.

View 5 Replies View Related

Illustrator Scripting :: Read External Data / XML Or TXT And Create Files Automatically

Feb 3, 2014

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.

View 1 Replies View Related

Illustrator Scripting :: How To Read Swatch Used For Fill Color Of A Page Item

Mar 21, 2012

Is there a way to read the swatch used for fill color of a page item?
 
I can read the fill color but I can't read if the color is a global swatch.

View 2 Replies View Related

Illustrator Scripting :: How To Use Imported Text As A Number

May 13, 2013

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?

View 2 Replies View Related

Illustrator :: How To Rotate Pattern Within Shape

Oct 3, 2011

How can I rotate a pattern within a shape?

View 8 Replies View Related

Illustrator Scripting :: Rounding Text Size To Nearest Whole Number?

Jun 13, 2013

I've had to rescale some artwork, but now I'm left with type sizes that are 71.68px tall, 34.51px tall, etc.
 
Is there a script that'll snap all the text in a document to it's nearest whole number or 0.1 decimal?

View 7 Replies View Related

Illustrator :: Gradient Does Not Rotate When Rotating Shape

Dec 17, 2012

Completely unlike the way Illustrator worked in previous versions, when I rotate a shape (say a square) that has a gradient in it, the gradient does not rotate with the object. For example if it is a black to white gradient and initially the black is at the bottom of the square, if I rotate the square instead of the gradient moving to the top, it stays at bottom. Same thing if its rotated to other rotations, 45 degrees moves the black to a corner etc. I can't find this anywhere, is it a preference? I've had 2 installs of Illustrator now on 2 clean Windows 7 installs and its still the same. A very frustrating workflow being that I am an animator, I don't want to have to manually change a gradient everytime I do another frame.

View 3 Replies View Related

Illustrator Scripting :: Regex - Limit Input To A Positive Number (float Or Int)

May 14, 2013

I wish to limit the user input of and edittext to only allow a positive number, float or int. I do not yet know my Regex good enough to do this. I realize that I must get better at regex but in the meantime how to do this ?
 
I have used this so far on the edittext:
 
function checkTextInput()
{
if (this.text.match(/[^0-9.]/g))
{
this.text = this.text.replace(/[^0-9.]/g, "");

}

 
Which matches
000.0001
0.45.000.1
...1
which is not desired.
 
Desired is
0.n
.n
n.n

View 1 Replies View Related

Illustrator Scripting :: Allow To Select Image To Replace Any Number Of Selected Files

Apr 18, 2013

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. 

View 6 Replies View Related

Illustrator Scripting :: How To Align Text With A Shape

Aug 14, 2012

How i can align vertical center and horizontal center a single line text to a shape (in vbs) ?

View 1 Replies View Related

Illustrator Scripting :: Replicate Shape Programmatically (JS)?

Oct 1, 2012

Any way to replicate an path object programmatically in a script? I'm searching for something like JavaScript's .toSource equivalent...

View 4 Replies View Related

Illustrator :: How To Create Text Names Within A Number Or Shape

Feb 28, 2013

I would like to learn how to create a print design for college hoodies. I get asked all the time but it takes me a very long time to do it. I am sure there is a quicker way in illustrator.
 
I want to create a design like this image. I am using Illustrator CS 5.1 right now.

View 4 Replies View Related

Illustrator Scripting :: Detecting Objects Inside Shape?

Jun 18, 2012

so I came up with this script, and it worked fine until I tried it on a different file. I have moved the artboard around all over the "main" canvas (if that is what it is called) and on the one that it works on, seems to only work when artboard(top, left) is positive values. however on the new file it doesn't seem to matter where it is on the artboard, it wont work anywhere. it should find the textpath relative to the shapes position.
 
I thought it was the coordinateSystem, but that doesn't seem to fix it. How the canvas works (maybe the math.abs();
 
threw it up on gist because it was pretty big: [URL]

View 3 Replies View Related

Illustrator Scripting :: Fill A Shape With Instances Of A Symbol?

Sep 6, 2012

I'd like to fill a shape with instances of a symbol. The sybmols should vary in size but never touch each other or the outer edges of my shape. Is there a script that can do this?

[URL]

View 1 Replies View Related

Illustrator Scripting :: How To Make Custom Shape Using JavaScript

Oct 1, 2013

I would like to create a trapezoid shape and be able to color it in, just like I'm able to do with the PathItems (e.g. rectangle, ellipse). I would like to be able to do this in Javascript.
 
I was thinking it might have to do with PathPoints, but Adobe's Scripting Reference Guide does not make it clear.

View 3 Replies View Related

Illustrator Scripting :: Way To Add / Remove / Redistribute Anchor Points On Compound Shape

Sep 10, 2013

I am wondering if there is a way to add/remove/redistribute anchor points on a compound shape so that there are evenly spaced anchors along the outline of that shape.I am aware of the "add anchor points" command. But that adds a new anchor at EVERY midpoint between two anchors. It doesn't smartly calculate where to add and where to avoid adding anchors.

View 1 Replies View Related

Edge Animate CC :: How To Read The Value Of A Text Box Into A Variable

Feb 21, 2013

I've tried the following: resVel = window.document.getElementById("txtVel").value;
 
this normally works in javascript, but crashes when using that line in the actions for a trigger.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Check If System Variable Is Read Only

Nov 22, 2012

How do I check, with LISP, if a System Variable is read only? In particular ANNOTATIVEDWG. This one is read/write when there are no annotative objects in a drawing, but read-only if there are.

View 7 Replies View Related

GIMP :: How To Make Curves Spline Get Variable Instead Of Number

May 9, 2012

I've been trying to make gimp-curves-spline get variable (which is number)instead of number and I get error.

For example -when I do:
*(gimp-curves-spline drawable 0 6 #(0 0 0 15 255 255))*

everything works well as it should be.

but if I do:*(define spoint 15)*
*(gimp-curves-spline drawable 0 6 #(0 0 0 spoint 255 255))*

I get an error: *Error: Item 4 in vector is not a number (argument 4 forfunction gimp-curves-spline) #( 0 0 0 spoint 255 255 )*As you can see, all I did was replacing the number 15 with a variable(which is a number) I also check it is a number by the *number?* type predicate

View 2 Replies View Related

AutoCad 2D :: System Variable To Keep Stacked Fraction With Leading Number?

Jul 5, 2011

System variable to keep a stacked fraction with the leading number?

We open the same drawing on different computers at work and on one computer the number will be 21/2 but on the next computer that opens the same dwg the 1/2 will have been bumped down to the the following line. I don't know if this is a problem with the autostack properties, although I can't find anything about that, or if its a problem with the tabs.

I'm completely at a loss and its becoming a problem because if one person opens a project to plot it and it looks fine but the next person opens it and every mtext in the dwg is wrong it becomes very time consuming to fix.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Unable To Read Plot Settings From Variable In Text File

Sep 2, 2012

I’m trying to create a plot command that reads settings in from a variable stored in a text file but its becoming muddled up somewhere.

(defun c:MYPLOT ();Setting nessesary variables...(setq fname "C:/ICT/AutoCAD_Architecture_Suite_2012/CUSTOM/TREADSTONE/PEN/MYOUTPUTDEVICE.PEN")(if(setq f(open fname "r"))(while (setq MYOUTPUTDEVICE (read-line f))(close)))(setq fname "C:/ICT/AutoCAD_Architecture_Suite_2012/CUSTOM/TREADSTONE/PEN/MYPAPERSIZE.PEN")
[code].......

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved