I'm needing to loop through each character of a text frame and check the color of each character. Is it possible to get the swatch name of each character? Or can you only get the red, green, blue values?
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.
Is it possible to use a JS script to find/replace artboard names? For example if I have artboards that are currently named 39 and 42...can I use a script to change the name of the art boards to 39E and 42C etc?
Also part of the script a simple find/replace of text on locked layers.
I'm trying to find a way to loop thru all items in an Illustrator document and get their stroke and fill color. Sometimes items are spots, sometimes documents are set to RGB or CMYK, etc, so swatches can be a mixture of things. Is there an easy way to get the swatch name for each item?
For example, I can check if an item is a spot, and get it's color like so:
var c = app.activeDocument.pageItems[0]; if (c.strokeColor.typename === 'SpotColor') { var s = c.strokeColor.spot.name; }
But if I try to get the name from an item colored 'Black' (which is set to Process Color, CMYK), then I'll need to do something else like:
var c = app.activeDocument.pageItems[0]; if (c.strokeColor.typename === 'CMYKColor') { var s = c.strokeColor.name; // This returns undefined - not sure what I'm doing!!! }
Is there an easier way to achieve this, other than getting the typename of each item, and then trying to figure out it's color name? I was hoping something like this would work:
var c = app.activeDocument.pageItems[0].strokeColor.name;
I'm trying to find a way to get the links and link statuses in Adobe Illustrator. It doesn't seem to be at all similar to InDesign DOM.
What I'd like to be able to do is check whether a file has a missing link. I have been able to trace it to a "placedItem" which is inherently a "pageItem". So is it possible to find the link status? Been going through the DOM for about a half hour now and still can't find it.
app.documents[0].placedItems[0] <--- How to get link status?
I have a number of art items on a document, some of them are filled with spot colors and some of them are with process color.Is there any method by which I can find out which color type(spot or process) is applied to the selected art item?
Are there any scripts to find and replace layer names?
There is an excellent script available for Photoshop which allows you to not only replace words in layer names, but also insert words as Prefixes, Suffixes and Sequential Numbers. The illustrator version of this script only allows sequential numbering: It doesn't offer find and replacing of words.
Ideally, it would be great if there was something that could do multiple find and replaces in one go:
(E.g. You have layers like this Car, Dog, Bat You enter: car(Option1), dog(Option2), Bat(Option3) Your layers then become: Option1, Option2, Option3). )
I have multiple documents using text as symbols. I need to change a ® 2013 to a ® 2014 within the symbols. Without having to go into each document and double click on the symbol or break the link, is there a way to do a batch find and replace that will search within symbols to change text?
Is it possible to find out how bright is an color? I need to find the darkest color in document's swatches. My solution would be to convert (script internally, without actually making any changes in document) swatches to grayscale, compare them and pick the darkest. But how to convert swatch defined in undefined mode (they might be in lab or cmyk) to grayscale?
I found in 'js scriping reference' a method "convertSampleColor", but I have no idea how to use it. Any examples?
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".
Is it possible to write an Illustrator (CS4) script that would find and replace 2 instances of text using the actual file name to supply the changing text?
Our current file naming system uses a Part Number, Catalog Number and Run Date. (example: 123456_ABCDEF_2014 JN)We are currently saving a master file as the new Part Number and simply doing 2 separate find and replace functions for the Catalog Number and Run Date. Unfortunately we have over 500 parts to change and thought we could narrow down the 1000 find and replace to just 500. Although this may not appear like such a time saver, the key factor would mean entering the changing data just once per file, minimizing errors and eliminating proof reading the actual file.
Here is what I have used for a simple find and replace script, but I cannot seem to find any information to connect the file name data.
[code]
var active_doc = app.activeDocument; var search_string = /ABCDEF/gi; // g for global search, remove i to make a case sensitive search var replace_string = "GHIJKL"; var text_frames = active_doc.textFrames; var search_string2 = /1234 XX/gi; // g for global search, remove i to make a case sensitive search var replace_string2 = "5678 YY";
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?
I'm working with a couple Illustrator stock patterns. I'd like to simply invert them so they're white instead of black. Any way to do this without actually editing the pattern itself? The one I'm working on is too complex to edit effectively...
I have been tying to figure out how I could easily embed multiple linked images easily. I have some 1000 .svg images which have about 1-7 .tif images linked in to them. I now need to get those links embedded and becouse of the amount of images I'm hoping to make an action out of it.
I've been trying to hatch a complex image with a single pattern, but with different stroke weights.
Here I added an image of a simple greyscale image with below the hatching that I'm trying to make. In short: I want to use only 45 deg. hatches in this direction. However, based on the grey value, I'd like the hatches to have different weights.
However, since this image is quite simple, only four different weights were needed. However, I'd like to know if there is an easy way to do this for complex images. For this image I just used pattern fills with different stroke weights, but I'd like a smoother and easier solution, preferably one where it would be possible to have many different weights without having to split up the image in thirty different parts and making thirty different pattern fills.
I'm not sure if this is possible, but I might be overlooking something. If it would be possible with a plugin, I'd like to know too. Even if there might be a workaround via Photoshop, and the end-result would not be a perfect vector, It'd be fine.
I have set up a 20x20 pixel grid and I want to easily try out a few mockup layouts. No matter what I try, Illustrator simply does not snap to grid. I have to zoom in really close to align each shape.
Surprisingly it does not snap to guides either, leaving me completely hopeless. I have snap to pixel on and all objects are set to align to pixel grid.
i regularly have to print out colours for sublimating fabric, and use illustrator to create a panel of blends to print out.
I put four colours in the corners, make an 18 step blend or the top two, then the bottom two, expand them then ungroup them, and then change the blend options to 8 steps and blend them vertically one by one.
all in all it's several minutes work, but i thought i could change the values of the four corners, and then use actions to blend the grid.
initially it stopped and told me ungroup was unavailable, so i created smaller steps, but still can't get it to work.
is this possible, or do i carry on manually crating grids? or is there another way?
Say I had a group of windows in one layer. A wall in a layer beneath and a giant flock of birds in the layer below that. How would I be able to make the birds visible in the windows while keeping the flock easily editable? CLipping masks seem to only work well with single objects.
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?
Using the new caracter font scroll feature in CS6. When scrolling through fonts by highlighting in the carater box and watching my type change from font to font, it will come to a stop at certain fonts.