Illustrator SDK :: Loop Through Layers And Determine If Its Text Layer
Aug 20, 2012
I am trying to loop/iterate through all layers, determine if it's a "text-layer", if it is, set it's opacity to 0.This is what I have so far:
var iapp = new Illustrator.Application();
var openoptions = new Illustrator.OpenOptions();
var idoc = iapp.Open("c:\myFile.pdf", Illustrator.AiDocumentColorSpace.aiDocumentRGBColor, openoptions);
Illustrator.Layer mainlayer = idoc.Layers["Layer 1"];
[code]....
is there a way that I can loop through all layers and sublayers looking for a name of a layer? I have one that loops through only top level layers. I am thinking I have to somehow incorperate all pathItems, groupItems and the like to incorperate all types of "layers" there might be, since a group is technically not a layer but a groupItem.
this is what I am doing so far:
for (var i = 0; i < numberOfLayers; i++) { var customName = "div structure"; var myLayer = app.activeDocument.layers[i];
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.
I have a somewhat complex document with many layers that have similar colors. Is there some way to identify the layer of a particular element using my mouse cursor in AutoCAD WS?
I was just working on several documents when something strange happened - out of nothing the appearance of fonts,layers, backgrounds etc changed. white color turned black. some layers had total different colors ( bitmap layers, no shape layers) - everything looked really messed up. I thought its some display bug in Photoshop cc so I saved my document and restart everything - fun thing -> it did save with these alterations.
Whatever happened, I have the problem in 2 documents, i can't reproduce it - one was a pretty big psd file - the other one was a fairly new one. Because of Time machine i was able to recover my file.
Retina Macbook Pro 15, OSX 10.8.4 and newest photoshop CC via teamcloud.
I am trying to develop an animated GIF to use as a web-ad, I have readthe docs and googled but still having problems :-(
The ad (portrait format) is very simple: a background logo at thebottom of the ad, and three different text messages which rotate. Ithus created a bottom layer with the logo covering the bottom third; asecond layer with nothing but the first text message on the upper2/3rds, another layer with the second text message also in the upper2/3rds and finally a layer with the third text message in the upper2/3rds. While the logo at the bottom should be displayed at all timesthe three different text messages are shown one at a time.
After reading the docs I then expanded each layer with a text messageto be as large as the ad itself. My next step was to try to create alayer mask - for each of the three layers with the text messages, saidlayer mask to cover only the lower 1/3 where it would be transparent.
This is where I ran into problems, no matter what I tried, I could notaccomplish this. There must be something very basic I have yet tounderstand!
Last, in order to create the animated GIF, I exported all four layersusing "replace" in the dialog box. I also experimented with "combine"to no avail. No matter what I tried, I either ended up with an animatedGIF where the logo and the three different text messages over timebecame overlaid, or, an animated GIF where only one thing was shown atone time.
Is there a way to search the database/tables/whatever to determine if new layers are present in a drawing?
I want to run a script to reconcile new layers in the sheet drawings after having cleaned the xref drawings, and the script bombs if there are no new layers present in the parent drawing.
If I could determine what triggers the layereval/layernotify sequence (tblsearch?) I could include an if or while lisp routine that would invoke the layer command and then reconcile the new layers.
Im trying to create a logo. I grouped a bottom layer of shapes to form one shape. I also group three letter together. When i put the group of letter on top of the group of shapes it looked great. Then i tried to group this bottom and top layer together and lost the top layer of letters...how can i stop this from happening?
I have just been updated to CC at work and I am having all sorts of issues. But the two main pressing ones are:
1. When I save, it keeps "not responding". Sometimes it crashes, sometimes it doesn't. When it does, I lose everything. It takes anywhere from 1 - 5 minutes to save. I thought it was an issue with a large file, but it does it to me in a one page file with only one photo in it as well.
2. Layers. This is the killer right here. Again, I thought this was a capatability issue when using old files, but it has proved me wrong. As I create layers and new artwork, it works fine. However, once I save and re-open the file, all the artwork has been combined to a single layer and then I have to dig it all out to do anything to it, only to have it do the same thing the next time I repoen the file.
Is it me? Is it default settings somewhere in CC? I have major deadlines that I think I am going to miss if things keep continueing the way they are.
System Specs: Illustrator CC 16.0.3 (Tried to update to 17 and it said everything was up to date, twice) Windows 7 Dell Optiplex 7010 with Core i7 and brand new AMD video card.
How do I copy PARTS of layers containing many objects from one CS5 AI (v.15.0.2) doc into a new CS5 AI doc and keep/create the same layer names?
To start with, I have one fairly complex AI document with 100 layers, with several hundred items in each layer. For example, one layer named "Stars" contains 400 separate stars (not grouped), another layer named "Crosses" contains 300 separate crosses, and a 3rd layer named "Text" contains 200 separate words (not outlined).
If I select, by marqueeing a section of the image/artboard, some (but not all) of the individual items contained in the several layers, then paste that selection into a new CS5 AI doc, I cannot get them to create new layers of the same name. Instead they go into one general layer (e.g. "Layer 101") as a jumble of discrete, but unorganized objects (no layers or sublayers). In other words, I have lost the 3 main layers from which I selected a bunch of objects.
Checking "Paste Remembers Layers" has no effect on this result. In fact "Paste Remembers Layers" does not remember layers at all. Only if I select ALL the items in the several layers will it paste those layers by those names into the new doc (or create new layers of the same names).
Of course it is a COLOSSAL waste of time copying the ENTIRE document, then pasting the WHOLE thing into the new doc (with layers retained), then deleting the parts I DON'T need.
I have just finished designing my characters. Now I have to create my background. I figured to do this, I would simply have to create my background and hide the layers above so I can see what I'm doing. However the few lines that I've created in my background are overlaping the characters, how can I resolve this?
Also after doing a brush or creating a path in general, how do i I deselect it (instead of having to bring out the selection tool and clicking anywhere on the screen)
I jut remembered something else, if i want to select an object but the selection rectangle covers the perimeter of another object, how do I avoid selecting the other object aswell?
I'm new in scripting and i need to make a script that moving all layers into a single layer (in Illustrator i press CTRL+A then CTRL+G in layers and works) but i need that in script.
The 'Template' checkbox gets activated in Layer Options dialog box, and the box gets closed, then, the Layer name and several icons at the bottom of the Layer Panel disappear.The Layer is still there without a name, and rolling over the icons on the Layers Panel I can see the Tool Icons.Illustrator Prefs were trashed/restored using the Opt-Shift-Command restart shortcut.
I am trying to turn every layer in my .ai file to a raster image without flattening to one layer.
-The big issue I am dealing with is the agency that just built a paralax site for us refuses to export to PSD. I have tried every possible way to do this but keep getting the file is to big message. To add to it they had it all on 1 layer. I was able to release to sequence, but now am trying to see if rasterizing the objects will work.
I have a single file with couple objects on different layers. When I copy/paste into other files, the objects seem to be grouped and layer information disappeared. Can I move around objects with layer setting as well?
I have two layers. Upper most with text is locked.Bottom layer is an image I have applied a transparency/gradient mask for the raster image. Now, seems my layers palette is stuck in a mode called 'Layers (Opacity Mask)'.Not seen this before, but this is CS6. How do I get out to the main, root level of the layers palette?
Note Layer > Duplicate will not work in this regard, because I want to copy one group of paths/elements from one layer to other existing layers, not to a new layer.
I have not found a command for this, nor have I found any scripts. Note I'm using CS3 but have been thinking about an upgrade.
AI CS6 Layers panel missing labels when you deselect print in the layer options. Is this a bug? I noticed this on a furnished file at work on a MacPro and had a hard time working the file because all of the labels were missing.
I stumbled on the cause when I turned on the Print Layer and all the labels came back. To be sure it was not computer related, I made a file on my AI CS6 version 16.1.0 with the same result. See screen shot.
I use Adobe Illustrator CS4 and I have a logo (.ai file in CMYK) that uses 2 colors. I don't know how to convert / find what Pantone colors my logo uses.
how to get/determine the visible bounds (top+left coords and width+height or Rect structure) of a group having a clipping mask or several masks? When a script asks for Visible Bounds, Illustrator provides the coords/size of the group like it does not have any clipping mask. So, you see a circle of 10px diameter (and these are the actual visible bounds of this group), but Illustrator says that the visible bounds are 50 px wide and 70 px in height.
And what to do if the group contains multiple clipping masks of different shapes/sizes?
Is it possible to loop thru the artboards (with Illustrator CS5) and only work with the pageItems on the current iterated artboard?
For example, if I have 3 artboards, with 2 textFrames on each artboard. And I add the textFrames sporadically (I add a TextFrame with contents "Text 1" on artboard 1, then a textFrame with contents "Text 2" on artboard 3, then a textFrame with contents "Text 3" on artboard 1, etc).
Artboard 1: Text 1 Text 3
Artboard 2: Text 4 Text 6
Artboard 3: Text 5 Text 2
Is there a way to loop thru these artboards and get the textFrames tied to the appropariate artboard? So, on the first iteration of the loop, I'm looking at artboard 1 and only looking at "Text 1" and "Text 3", then on the the 2nd iteration I'd be working with artboard 2 and it's textFrames "Text 4" and "Text 6", and so on.
If I loop thru only the doc.textFrames, the order would be incorrect, with the way I added each textFrame. Instead of artboard order, they'd be in this order:
I am just learning Illustrator. I use a PC at work, and a laptop at home. I have several layers of text in my document. The text is larger on my laptop than it is on my PC. The "character information" doesn't change (if it's 100 on my PC, it's 100 on my laptop), and the placement doesn't change, just the size of text. All other items such as placed objects and drawn graphics stay the same. I have been saving the file into a server folder, then copying it over to my laptop desktop at home. Have not had this happen in Photoshop or In Design. Is this a document issue, a preferences issue or a font issue?