Illustrator Scripting :: Iterate Through Selected Characters

May 3, 2012

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;

View 14 Replies


ADVERTISEMENT

Illustrator Scripting :: Iterate And Remove Objects In A Layer

Apr 9, 2013

I am trying to iterate through objects in a layer and if the object satisfy a condition, I want to remove it.
 
Problem is that from what I suspect, if I use a "for loop" then when I remove an element, the initial length of the loop becomes invalid by removing the element. So what I would need is to iterate through objects in another matter and I am clueless.

View 3 Replies View Related

Illustrator Scripting :: How To Iterate Story To Find If Characterstyle Is Applied To Its Textranges

Apr 18, 2013

Does source like below work?
 
characterStyle.parent == theStory.textRanges[i]
 
One more questions is if there might be a CharacterAttribute who belongs no characterstyle? Can I iterate charaterstyles to know all the font, bold .. information for all teh textranges?

View 5 Replies View Related

Illustrator Scripting :: How To Set Character Attributes On A Range Of Characters At Once

Jan 11, 2014

Illustrator Version CS3-CC
Preferred scripting: Visual Basic (VBScript)
 
In the Adobe Illustrator CS5 Scripting Reference (VBScript), I see the following code for setting character attributes.
 
iCount = textRef.Characters.Count
i = 1
Dim charRef
Do While (i < (iCount + 1))
dSize = dSize * 1.1
textRef.TextRange.Characters(i).CharacterAttributes.HorizontalScale = dSize
textRef.TextRange.Characters(i).CharacterAttributes.VerticalScale = dSize
i = i + 1
Loop
 
Is there a way to set character attributes on a range of characters at once?
 
Iterating through the characters one by one is really slow, especially in higher versions of Illustrator (like CS6).
 
I want to be able to set character attributes, for example, from the third character to the sixth character of a paragraph textrange.
 
Basically, I want to do something like itembyrange in InDesign scripting.

View 3 Replies View Related

Illustrator Scripting :: Divide Characters In Text Frame

Oct 23, 2012

I'm sending this message regarding this link : URL....Just need a favor with all my respect to you and i think you will not let me down asking u for 2 script to divide characters in the textbox like the following:
 
1st : (TEXT FRAME) : Each letter alone and delete the space character .. with out moving any character from it's position
2nd : (TEXT FRAME) : Each word alone and keep the space character
 
"both in multiple text frame".

View 5 Replies View Related

Illustrator Scripting :: Remove Horizontal Scale On Circular Characters Only?

Sep 18, 2013

Lino's CrTronic used to have a command to set horizontal scaling to 100% for these 3 characters, and leave the rest alone.

® circle R
© circle C
• bullet
 
Because those 3 characters are circles we often want them proportional even if the rest of the copy is horizontally scaled.

View 18 Replies View Related

Illustrator Scripting :: Special Characters - Wrong Result With Bridge Talk In Loaded Script

Jun 10, 2013

Why is this so and what can I do?
 
I use several scripts in Illustrator. Some of them I use in this way: [URL] ....
 
Now I tried to built in two other scripts in the palette. In this scripts it is required to use special characters in variables. Standalone these scripts are work correct. Here is an simple example:
 
// exampleScript.jsx
var a = 'u201d'+" example "+'u201d';
alert(a)
 
I get this (correct) result:
 
But when I call this example script with bridge talk:

var scriptToLoad = new File(pathToScript + "/exampleScript.jsx");
var win = new Window('palette', 'own palette');
var btnSelect = win.add('button', undefined, 'example');
[Code] .....
 
Here is the same script and the wrong result:

View 9 Replies View Related

Illustrator Scripting :: Get Position Of Selected Object

Oct 4, 2012

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.

View 5 Replies View Related

Illustrator Scripting :: How To Determine The Size Of Selected Text

Sep 6, 2012

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. 

View 6 Replies View Related

Illustrator Scripting :: Align Selected Objects To Artboard

Nov 15, 2013

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.

View 11 Replies View Related

Illustrator Scripting :: Convert To Grayscale For Selected Item

Feb 4, 2014

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)?

View 12 Replies View Related

Illustrator Scripting :: How To Set Color For Each Selected Object Via Eyedropper

May 30, 2013

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?

View 1 Replies View Related

Illustrator Scripting :: Get Width That Multiple Selected Items?

Apr 23, 2013

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 ----------

View 3 Replies View Related

Illustrator Scripting :: Turn Selected Sublayers Into Top Level Layers

Jun 5, 2008

I wanted to ask if by chance any of the scripting gurus here happen to have written an AI script that will take a number of selected sublayers/sub-sublayers and move them so they become top-level layers?

I am really needing this very badly, given that After Effects can only handle AI layers as separate entities. So I find myself moving tens, even hundreds of nested sublayers to the top level all the time.

Is it possible this script exists already?

View 16 Replies View Related

Illustrator Scripting :: How To Return Array Of Paths In The Order They Were Selected

Feb 1, 2013

Is there a method to return an array of paths in the order they were selected, instead of their descending z-index (default behaviour)?
 
I'm writing a script that "connects" the centers of currently selected objects through a stroked path, and I want it to follow the order in which I select the objects, regardless of the stacking order.

View 13 Replies View Related

Illustrator Scripting :: Replace Layer Names In Selected Layers Only?

Jan 22, 2014

I am using this script to find and replace words in layers. (The script only targets particualr words, rather than the whole layer name).
 
I would like to make it so it targets selected layers only.
 
I have found this script which loops through selected layers only, but I am not sure how to add the find and replace layer name functioality.

View 7 Replies View Related

Illustrator Scripting :: Changing Selected Text Color With JavaScript

Feb 25, 2013

I want to change my selected text to a different cmyk color using javascript. I have tried and I do not know what is missing or what I am doing wrong.
 
if ( app.documents.length > 0 ) {
newCMYKColor = new CMYKColor();
newCMYKColor.black = 0;

[Code]...

View 4 Replies View Related

Illustrator Scripting :: Export Selected Artboards PNG24 JavaScript?

Mar 1, 2013

I'm trying to do some workflow enhancements. For our games we need to export to PNG at different resolutions for different mobile devices. I use a artboard per asset and currently manually export 3 times (using file/export/png with use artboards option), at 72 dpi, 144 dpi and 33.75 dpi.
 
I've been modifying a simple Javascript I downlaoded and have got it save to different fixed locations at different scales. All good. However exporting every artboard each time will cause issues with our version control system and take too long. It's not really a solution.
 
So I need a way to either only export the current selected artboards (which I believe can't be done) or somewho show the artboard range dialog that the system uses. Either of those would be a good solution.
 
var docRef = app.activeDocument;
var num_artboards = docRef.artboards.length;
var getName = app.activeDocument.name;
var fileName = getName.slice(0, -3);
[code]...

View 7 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 :: JavaScript To Send Selected TextFrame To Current Layer?

Feb 20, 2013

Is there a way to send a selected textFrame item to a layer using javascript?
 
I don't mind if it is send to current layer or some other way to accomplish the task.
 
(Using Adobe Illustrator CS4)

View 5 Replies View Related

Illustrator Scripting :: CS5 - Change Fill Color Of Selected Path Items

Apr 2, 2013

I'm trying to create a script in CS5 mac os10.6.8 that will change the fill color of selected pathItems. I need a simple script that will change a selected pathItem to cmyk values 2,3,15,0. I will then select this script and implement the action in a batch of 600 files.
 
I wish this process could be recorded as an action but when I record the action "add new swatch" I have to manually input the cmyk values, which will take forever for a batch of over 600 files.

View 15 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 :: Simple / Direct Method To Identify Index Of Selected Item In List Box

Jul 16, 2013

I can't seem to figure out a simple/direct method to identify the index of the selected item in a list box.

I feel like I'm missing something, but I can't seem to figure which (if any) property returns an index number if you use it with the .onChange callback for a ListBox.

The following code accomplishes what I need but isn't particularly efficient or elegant and can get muddled if you introduce multiple lists to check.

Any way to duplicate this same behavior with better code
 
var res = "palette {text: 'Example List', properties:{resizeable:true}
pnl: Panel{orientation: 'row',preferredSize: [400,600],
list1: ListBox{preferredSize: [400,550], properties:{multiselect:true,numberOfColumns:2, showHeaders:true,columnTitles: ['List 1', 'Subitem 0']}},
}}"

[Code]...

View 4 Replies View Related

Illustrator Scripting :: Adding Serial Numbers Apply To Multiple Files In Selected Folder?

Dec 19, 2011

How to make the following script for adding serial numbers apply to multiple files in a selected folder?
 
var docRef = app.activeDocument;
with (docRef) { 
var docName = name.substring(0, name.lastIndexOf('.'));
var artRight = visibleBounds[2];

[Code] .....

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Removing Last Characters Of Block Name In Selected Object?

Jul 29, 2013

When i export revit drawing with revit family 

the revit family become block in autocad like this

M_Single-Flush - 700 x 2200mm-278353-Ground Level _0_45

usually i want to remove the ID and view name to become like this without have to re type because it is tedious

M_Single-Flush - 700 x 2200mm

something like how many letters you want to remove from last to first ?

or something better like remove this last two dash and the letters embedded inside ( that separate name-ID-View name)  -278353-Ground Level _0_45?

View 9 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 :: Access Graph Data Through Scripting DOM?

May 6, 2012

Can you access graph data through the scripting DOM?

View 3 Replies View Related

Illustrator :: Stretching Single Characters In CS6?

Apr 18, 2013

I am working on a logo which has the word "E-Commerce" in it. I am using a font that works quite well for it but the dash is way too long, it's in fact longer than an m dash and the font doesn't have anything else.
 
Short of modifying the font file or turning it into outlines, is there a way I can just make that one character shorter? I seem to remember that in earlier versions of Illustrator you could set the font width but all I can see in the character pane in CS6 is kerning and tracking. I don't want to use the transform tool because it would stretch all the text inside the box.

View 3 Replies View Related

Illustrator :: Type A Column (Two Characters On A Line)

Nov 21, 2013

So I want to type in a column, so I went to type > type orientation. However, Each character is vertical. I want to type two characters on a line, then break to the next 'line', as I'm working on a calendar piece and I want all numbers to be aligned straight up and down.

View 5 Replies View Related

Illustrator :: Exporting PDF To EMF - Loses Characters In Word

Jan 28, 2013

I am exporting a table - save from Excel to PDF. Open in AI and export to EMF.  The word 'Difficult' in one column comes out 'Dif  cult' in every occurance.  It worked with a different table one time last week but now happens with every table I attempt to export. I even went to an extra step of saving the PDF to AI and then exporting to EMF. Same results.

View 2 Replies View Related

Illustrator :: Typing Hebrew Characters In A Document?

Feb 23, 2014

How do I type hebrew characters in a document. Is there an on-screen keyboard that I can use similar to how microsoft word does? I am using Illustrator CC.

View 1 Replies View Related







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