Illustrator Scripting :: Loop Through All Layers And Sublayers?

Apr 26, 2012

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

[Code]....

View 6 Replies


ADVERTISEMENT

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 :: CS5 - Clean Way To Unlock Endless Sublayers?

Apr 28, 2012

I've written a snippet that will unlock sub of sub layers up to 10 layers deep. It works fine; however I'm wondering if there is a better way to do this? I don't know that 10 is the maximum of sub layers I'll need to unlock but it's a fairly safe guess. I'd like to be more efficient and know that no matter what the layer structure of the file my script has unlocked any and all sublayers.
 
Is there a different approach or way to think about this problem where you can script for a potentially endless number of sublayers, and subs of subs, etc.?
 
var doc = app.activeDocument;
var layerCount = doc.layers.length;
for (i=0; i<layerCount; i++) {
var currentLayerI = doc.layers[i];
var layerCountII = currentLayerI.layers.length;
for (ii=0; ii<layerCountII; ii++) {
[Code] .....

View 4 Replies View Related

Illustrator :: How To Opens All Of The Layers Which Contain Sublayers

May 7, 2012

I just installed cs6, and when I open files in Illustrator, it opens all of the layers which contain sublayers.  It does this even if all the top-level layers were closed during the previous save.  The files I work with have a large layer-structure, so re-closing the top-level layers every time I open a file wastes a lot of my time.  Can I close all layers at once, or better yet, can I stop Illustrator from opening all of the layers automatically when I load a file?
 
If not, then WHY on earth not?  I can't be the only one who opens and closes large files with lots of layers and sub-layers...

Edit: I also am noticing this problem is even worse in cs6, because openning and closing individual layers plays a little animation of rotating the triangular arrow before the layer which, cute as it may be, just makes the task of individually closing up all my layers that much more tedious.  Can I turn off that little animation of the triangular arrow when opening and closing layers?

View 8 Replies View Related

Illustrator :: How To Copy Layer And Sublayers To Another Document And Keep Sublayers

Feb 17, 2013

I have 3 similar but different documents.  I made the edits to one of those and now I need to bring that over to the other 2 files.  I know I can copy and paste the areas I need to the other 2 files but when you do that, everything merges into a single layer.  How do I do this and keep those items in their own sublayers as well?

View 5 Replies View Related

Illustrator Scripting :: How To Loop Through The Artboards

Feb 7, 2012

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:
 
Text 1
Text 2
Text 3
Text 4
Text 5
Text 6

View 4 Replies View Related

Illustrator Scripting :: How To Find A Way To Loop Through All Items

Apr 6, 2012

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;

View 3 Replies View Related

Illustrator Scripting :: Recursive Loop Through File System

Apr 20, 2012

I'm trying to figure out if Javascript is my answer to my problem.  I've been able to re-write all my Applescripts that manipulate Illustrator except for the ones the need to use the file system.  We have switched to PC's at work and now I'm forced to figure this out.  Our art files are saved with a 7-digit number, followed by the name of the art in the file.  Ex:  1000049-Bob's Garage.  My applescript had a recursive loop that worked it's way down through the file structure on our art server until it found the lowest folder to which it belonged, then saved itself there.  Here's an example of how the server file structure (these are folder names) is layed out:
 
1000000-1004999
1005000-1005999
1010000-1014999
 
and so on.
 
The script would load all the foldernames in the first tier of the directory, loop through them and look at the first and last name of each these folder names, then compare the Illustrator filename to them.  If my file was between the two, then the loop called itself, loaded the folders inside that folder, and by doing so, worked it's way down through the folders, through the tree structure until there where no more folders.  At that point, the file was saved, in order, where it should be.

View 7 Replies View Related

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

View 1 Replies View Related

Illustrator Scripting :: Get Layers By Name VBA?

Apr 7, 2012

Is it possible to reference layers or groups by their names instead of their index using VBA? If so, what is the sytax? I know you can do it in Extendscript, but I'm not finding info for VBA.

View 7 Replies View Related

Illustrator SDK :: Count Sublayers In A Layer?

Aug 12, 2013

Is there a possibility to count (only) all sublayers in a given layer? CountLayers from LayerSuite is only counting top-level layers and that isn't good enough.
 
Edit: I am using CS SDK 5.

View 2 Replies View Related

Illustrator Scripting :: How To Export Layers To SVG

Feb 13, 2013

I am trying to export layers to SVG, but I need to access the "Use Artboards" option in my ExportType.SVG options.  I do not see it in the Javascript reference: [URL]....

View 8 Replies View Related

Illustrator Scripting :: Can Create Layers With CSV File?

May 9, 2013

Is there a script that can create layers with csv file?

View 5 Replies View Related

Illustrator Scripting :: Split Text Into Layers?

Jun 30, 2013

script that is able to do the same as this photoshop one [URL] ...., I would use that one in photoshop but its not working in CS6.
 
find a script that will seperate the text into layers ready for export to After Effects to be used in Kinetic Typography  pieces.

View 3 Replies View Related

Illustrator Scripting :: Move Layers To New Artboard

Feb 18, 2013

I'm trying to create a script via javascript for Illustrator.
 
My problem is : I have a AI file with multiple layers, i want to create one artboard per layer, in order to export a multipage PDF ( each page contain 1 layer ).
 
The layers represents the differents type of print ( vernish, color, hot gold, pressure ... ) and/or color type ( Pantone, CMYK, cut, kisscut ... ). My client want a PDF for see each type of print or color type per page.
 
I'm trying 2 ways :
 
1st solution : Create new artboards, and duplicate ( or move ) layers content on the new artboad, but the function move/duplicate don't work to move content on another artboard.
 
2nd solution : Create new document with the same number of layers as artboard and duplicate layer to the new artboard on the new document.

View 6 Replies View Related

Illustrator Scripting :: Expand And / Or Collapse Layers?

Mar 4, 2013

Whenever I open a file, Layers are randomly expanded in the Layers palette.
 
Is there a way to run a script that collapses and/or expands all layers?

View 3 Replies View Related

Illustrator Scripting :: How To Make A Script For Layers To PDF

Feb 6, 2014

make a script for layers to pdf?
 
ADHESIVE, WHITE, Layer-8, Layer-7, Layer-6, Layer-5, Layer-4, Layer-3, Layer-2 and Layer-1 needs to be on seperate pages.
 
Jobbnr and Passmerk / Registrationm. (incl. sub-layers) needs to be on all pages!!
 
HJELPELINJER, COLOR, CARRIER, Guides and Field Background don`t need a page.
 
Is it possible to make such a script?

View 1 Replies View Related

Illustrator Scripting :: How To Add Prototype To Layers Object

Jan 24, 2013

I am trying to add a prototype to the Layers object so I can do something like try{ .getByName(name) catch{ return null.   For when the named layer doesn't exist.  (It gives an error for me in CS5). So unfortunately me trying to go Layers.prototype. my method  doesn't seem to work at all.

View 3 Replies View Related

Illustrator Scripting :: Opening Files As Layers?

Jul 6, 2013

Is there a way to open a file as a layer? I want to open multiple files in the same window to make a collage. Currently, as I open each file they all open in separate windows. The "Open Document As Tabs" option in the User Interface preferences is not selected.

View 1 Replies View Related

Illustrator Scripting :: Deleting And Replacing Layers?

May 1, 2013

So I'm trying to create a fairly simple script that will measure the size of art on the artboard for making printing plates. That part I have working. But once I have made one file, I have to delete the measurements layer manually (which is where the script puts them) so that I can make the next one. I need the script to check and see if there is a layer called "measurements" delete it and then create a new one called "measurements" in which to put the dimensions of the (new) artwork. This way I can keep making files and "saving as" with a new name.

View 1 Replies View Related

Illustrator Scripting :: Removing Empty Layers

Feb 13, 2014

I am looking for a script that will look through all the layers in my file and if there are no objects on the layer I would like it to delete them.how to remove a layer with a script, just not how to identify a layer or many layers that may no have objects on them.

View 6 Replies View Related

Illustrator Scripting :: Placing All Symbols Into Layers

May 14, 2012

How I can place all my symbols at one time in the File and on there on layers? is this possible?
 
The only dialog box i could find is in the corner of the symbols palette is "Place symbol"... I tried to create an action but it wont go to the next symbol.

View 2 Replies View Related

Illustrator :: Show All Unhides Previously Hidden Sublayers

Jul 3, 2012

We all hide and unhide things constantly as we work.But when you do a Show All (CTRL+ALT+3), to effectively unhide all hidden objects, is there a way to do so without unhiding all hidden sublayers as well.
 
When I do a Show All, even sublayers that were hidden when the file was opened (and never unhidden) unhide along with all hidden objects.

View 2 Replies View Related

Illustrator Scripting :: Moving All Layers Into Single Layer

Nov 20, 2013

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.

View 2 Replies View Related

Illustrator Scripting :: Group Items Are Returning As Layers

Apr 5, 2012

I have a layer that contains two clipping groups (groups with a clip mask and other art).  When I call layer.groupItems it returns an empty array.  When I call layer.layers it returns the two clipping groups.  I need to know if these layers are clipping groups, but if they are coming back as layers how can I figure that out?

View 8 Replies View Related

Illustrator Scripting :: Create Fitted Artboards From Layers?

Oct 8, 2012

Any script that will create artboards for each separate layer?

View 1 Replies View Related

Illustrator Scripting :: Renaming Layers To Be The Text Inside

Oct 9, 2013

I've got an Illustrator CS6 document that has 500+ layers with individual words on them (a word cloud).  I'm needing to animate this in AE.  When I "Release to Layers (Sequence)", all of the layers become Layer 1, Layer 2, etc.  Is there a script that will rename all of those layers to be the text inside them? 
 
i.e. Layer 1 has the word "Pencil" as a sub-layer, editable text.. I need to rename the Top-Layer Layer 1 to "Pencil".  I'm hoping there is a script that can do this so I don't have to manually rename all of the layers.I have found this script:
 
var idoc = app.activeDocument;
var ilayer = idoc.activeLayer;
for (i=0; i<ilayer.layers.length; i++) {
    var isublayer = ilayer.layers[i];
    isublayer.name = isublayer.pageItems[0].name;
}
 
But is doesn't seem to do what I need.

View 8 Replies View Related

Illustrator Scripting :: Convert Layers In Document To Artboards?

Sep 24, 2013

Script which would convert the layers in a document to artboards? At present I have a lot of documents with a couple of hundred layers on each of them, but I've decided to change the way that I organise my workflow and started using artboards instead. I don't really have the time to spend moving them individually from a layer over on to an artboard as there are a lot.

View 1 Replies View Related

Illustrator Scripting :: Paste In Place Across Layers Script

Jun 1, 2012

I'm looking for a script to paste an object (paste in place) on top of all other layers in a file.
 
I know I can position a single object on the top layer and then turn the bottom layers on and off, but for my needs (and in this situation) I need to actually paste that object onto each layer.

View 1 Replies View Related

Illustrator Scripting :: Hide Layers Based On List?

Apr 8, 2011

I have a very complex graphic with many elements and I would like to find a way to hide layers based on a list.  In the documentation that there is a way to tell if a layer is hidden, but didn't see anything about a way to actually to control the hide/unhide property.  Is this possible?

View 15 Replies View Related

Illustrator Scripting :: Change Layer Colors Within Layers Palette In CS5?

Apr 3, 2012

For example I would like to make my images layer Green and my copy layer Red in my layers palette.

View 6 Replies View Related







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