Hide PageItems in separate layer

Hi all

New to Illustrator, but some knowledge in Indesign Scripting.

Request:

Need to find all hidden pageitems and move in separate script.

For Illustrator, code below does not work

#target illustrator 

var myDoc = app.activeDocument; 

for (var idx = 0; idx < myDoc.pageItems.length; idx++) 

    var pageItem = myDoc.pageItems[idx]; 

    if(pageItem.visible==false) 

    { 

        pageItem.layer.name = "Hide_Layer";//replace your layer name here 

    } 

}

But for Indesign, coding below works fine

var myDoc = app.activeDocument;  
for (var idx = 0; idx < myDoc.allPageItems.length; idx++)  
{  
    var pageItem = myDoc.allPageItems[idx];  
    if(pageItem.itemLayer.visible==false)  
    {  
        pageItem.itemLayer = "TestLayer";//replace your layer name here  
    }  
}  

Thanks in advance

Siraj

It works:

#target illustrator

IDoc var = app.activeDocument;

var pi = idoc.pageItems;

for (var i = 0; i)< pi.length;="">

var pageItem = pi [i];
var sneakyPete = idoc.layers.getByName ("Hide_Layer");

{if(pageItem.Hidden==true)}

pageItem.move (sneakyPete, ElementPlacement.PLACEATBEGINNING);

}

}

Tags: Illustrator

Similar Questions

  • Get all the PageItems in a layer?

    When I ask for all pageItems in a document, as follows:

    app.activeDocument.pathItems

    I get all the pageItems in the active document, regardless of where they are. But when I ask al the pageItems of a particular layer

    app.activeDocument.layers [1] .pathItems

    I only get the pathItems at the top level of the layer. Any pathItems who are buried in a GroupItem of replacement are not returned. Is it possible to see all pageItems in a layer, whether in group or not?

    No, the selection object.

    You must step through the object tree (IMHO), or, if nothing are selected:

    function GetSelPfade() {}
    var pf = app.activeDocument.pathItems;
    var p = new Array();
    for (i = 0; i
    {if (PF [i]. Selected is true)}
    p.push (PF [i]);
    }
    }
    return p;
    }

    .hasSelectedArtwork layers [n] = true;

    var p = GetSelPfade ();

    .hasSelectedArtwork layers [n] = false;

  • can you hide a motion guide layer

    If so is it special step to follow? I could not hide a guided movement layer, which is why if this is possible.

    Thank you

    It's simple in AS2 to do. The only requirement is that the thing that is guided by the trajectory must be a clip and the thing that you use for a mask must also be a clip. It is not even important whether the mask in a higher layer by the moving thing.

    (1) for the thing that you want to hide, make sure that it is in a layer alone. Make a movieclip and give it an instance name. I'll call him "myclip".

    (2) make another layer in the timeline panel for the mask and make the graph, you have to your mask into a movieclip and give an instance name. I'll call him 'mymask '. Make sure that the mask layer frameworks extend to cover all executives of the movement so that both the clip being hidden and the clip mask both exist at the same time all the time.

    (3) now on the timeline (preferably in a new layer), place this actionscript:

    myclip.setMask (mymask);

    If you need to hide several layers and want to use the same mask, simply perform another copy of your mask and give it a different instance name. A mask can be used to hide two different things have

  • A script to divide each color into a separate layer?

    Hello, I was just wondering if anyone knows of a script that can automate the task of taking a single layer with a few different colors in this (rare, I mean between 2-10 colors here) and separate each color to put on its own layer.

    I did a quick search on google and came across this Split to layers. Scripts Photoshop .
    It's not what I want to do specifically of course but it seems to me that it should be possible to change this to select sort of color threshold instead of select continuous blocks in the alpha channel. I had a look in the script but I would more hazy about how to modify the code for what I need.

    Here, anyone have any ideas?

    Thank you

    Then finally opening in photoshop, separate into layers and applying latest details (shading, highlights, more colors etc.)

    Personally, I think you might be better of sticking with Illustrator, once you vectorized the image.

    In the absence of anti-aliasing (I had to clean up the image significantly, PNG should worked better) and with a limited number of colors, a script approach seems indeed possible.

    This Script is strictly for RGB images and tries to determine the colors, if you know you could throw a bunch of code and set rather manually from the theArray.

    divide the regions of color to an RGB image in layers;

    2016, use it at your own risk.

    #target photoshop

    If (app.documents.length > 0) {}

    If (app.activeDocument.mode = DocumentMode.RGB) {}

    var (HAE) 1 = Number (timeString ());

    myDocument var = app.activeDocument.duplicate ("theCopy", true);

    var theLayer = myDocument.activeLayer;

    var histogram = myDocument.histogram;

    var total = 0;

    for (var n = 0; n)< histo.length;="" n++)="">

    Total = total + histo [n];

    };

    collect histograms and not 0-values;

    var theHistos = new Array;

    for (var m = 0; m< 3;="" m++)="">

    var histogram = myDocument.channels [m] .histogram;

    var values = new Array;

    for (var n = 0; n)< histo.length;="" n++)="">

    If (histo [n]! = 0) {theValues.push (n)}

    };

    theHistos.push ([historical, values])

    };

    ////////////////////////////////////

    var theArray = new Array;

    create the masking layer to determine which combinations of values exist more or less;

    Solid var = solidColorLayer (55, 128, 200, 'aaa', charIDToTypeID ("Dfrn"));

    Try;

    for (var n = 0; n)< thehistos[0][1].length;="" n++)="">

    ////////////////////////////////////

    for (var o = 0; o)< thehistos[1][1].length;="" o++)="">

    ////////////////////////////////////

    for (variety p = 0; p)< thehistos[2][1].length;="" p++)="">

    ////////////////////////////////////

    try {}

    $.writeln(theHistos[0][1][n]+"___"+theHistos[1][1][o]+"___"+theHistos[2][1][p]);

    changeSolidColorLayer (theHistos [0] [1] [n], theHistos [1] [1] [o], theHistos [2] [1] [p]);

    var checkHisto = myDocument.histogram;

    If (checkHisto [0] > 0) {}

    theArray.push ([theHistos [0] [1] [n], theHistos [1] [1] [o], theHistos [2] [1] [p]])

    };

    }

    catch (e) {};

    ////////////////////////////////////

    };

    ////////////////////////////////////

    };

    ////////////////////////////////////

    };

    theSolid.remove ();

    try to cut layers;

    for (var a = 0;< thearray.length;="" a++)="">

    try {}

    selectColorRange (theArray [a] [0], [a] [1] theArray, theArray [a] [2], 0);

    cutToLayer ();

    myDocument.activeLayer = theLayer;

    }

    catch (e) {};

    };

    var Number = time2 (timeString ());

    Alert (((TIME2-time1)/1000) +"seconds\nstart" + (HAE) 1 + ' \nend '+ time2)

    }

    };

    Select color range.

    function selectColorRange (g, theB, theR, blur) {}

    // =======================================================

    var idClrR = charIDToTypeID ("Llrc");

    var desc4 = new ActionDescriptor();

    var idFzns = charIDToTypeID ("Fzns");

    Desc4.putInteger (idFzns, blur);

    var idMnm = charIDToTypeID ("Mnm");

    var desc5 = new ActionDescriptor();

    idR var = charIDToTypeID ('Rd');

    Desc5.putDouble (idR, theR);

    idG var = charIDToTypeID ("Grn");

    Desc5.putDouble (idG, g);

    the IDB var = charIDToTypeID ("Bl");

    Desc5.putDouble (IDB, theB);

    var idRGCl = charIDToTypeID ("RGBC");

    Desc4.putObject (idMnm, idRGCl, desc5);

    var idMxm = charIDToTypeID ('Mxm');

    var desc6 = new ActionDescriptor();

    idR var = charIDToTypeID ('Rd');

    desc6.putDouble (idR, theR);

    idG var = charIDToTypeID ("Grn");

    desc6.putDouble (idG, g);

    the IDB var = charIDToTypeID ("Bl");

    desc6.putDouble (IDB, theB);

    var idRGCl = charIDToTypeID ("RGBC");

    Desc4.putObject (idMxm, idRGCl, desc6);

    var idcolorModel = stringIDToTypeID ('colorModel');

    Desc4.putInteger (idcolorModel, 0);

    executeAction (idClrR, desc4, DialogModes.NO);

    };

    cut layer.

    function cutToLayer () {}

    try {}

    // =======================================================

    var idCtTL = charIDToTypeID ("CtTL");

    executeAction (idCtTL, undefined, DialogModes.NO);

    return activeDocument.activeLayer

    } catch (e) {return undefined}

    };

    create a solid color layer.

    function solidColorLayer (theR, g, theB, theName, theBlendMode) {}

    // =======================================================

    var idMk = charIDToTypeID ("Mk");

    var desc10 = new ActionDescriptor();

    var idnull = charIDToTypeID ("null");

    var ref1 = new ActionReference();

    var idcontentLayer = stringIDToTypeID ("contentLayer");

    Ref1.putClass (idcontentLayer);

    desc10.putReference (idnull, ref1);

    var idUsng = charIDToTypeID ("Usng");

    var desc11 = new ActionDescriptor();

    var idNm = charIDToTypeID ("Nm");

    desc11.putString (idNm, theName);

    TSM var = charIDToTypeID ("Md");

    var idBlnM = charIDToTypeID ("BlnM");

    var idMltp = theBlendMode;

    desc11.putEnumerated (TSM, idBlnM, idMltp);

    var idType is charIDToTypeID ('Type');.

    var desc12 = new ActionDescriptor();

    var idClr = charIDToTypeID ("Clr");

    var desc13 = new ActionDescriptor();

    idRd var = charIDToTypeID ('Rd');

    desc13.putDouble (idRd, theR);

    var idGrn = charIDToTypeID ("Grn");

    desc13.putDouble (idGrn, g);

    var idBl = charIDToTypeID ("Bl");

    desc13.putDouble (idBl, theB);

    var idRGBC = charIDToTypeID ("RGBC");

    desc12.putObject (idClr, idRGBC, desc13);

    var idsolidColorLayer = stringIDToTypeID ("solidColorLayer");

    desc11.putObject (idType, idsolidColorLayer, desc12);

    var idcontentLayer = stringIDToTypeID ("contentLayer");

    desc10.putObject (idUsng, idcontentLayer, desc11);

    executeAction (idMk, desc10, DialogModes.NO);

    return app.activeDocument.activeLayer

    };

    changeSolidColor.

    function changeSolidColorLayer (theR, g, theB) {}

    try {}

    // =======================================================

    var idsetd = charIDToTypeID ("setd");

    var desc17 = new ActionDescriptor();

    var idnull = charIDToTypeID ("null");

    ref2 var = new ActionReference();

    var idcontentLayer = stringIDToTypeID ("contentLayer");

    var idOrdn = charIDToTypeID ('Ordn');

    var idTrgt = charIDToTypeID ("Trgt");

    ref2.putEnumerated (idcontentLayer, idOrdn, idTrgt);

    desc17.putReference (idnull, ref2);

    idT var = charIDToTypeID ("T");

    var desc18 = new ActionDescriptor();

    var idClr = charIDToTypeID ("Clr");

    var desc19 = new ActionDescriptor();

    idRd var = charIDToTypeID ('Rd');

    desc19.putDouble (idRd, theR);

    var idGrn = charIDToTypeID ("Grn");

    desc19.putDouble (idGrn, g);

    var idBl = charIDToTypeID ("Bl");

    desc19.putDouble (idBl, theB);

    var idRGBC = charIDToTypeID ("RGBC");

    desc18.putObject (idClr, idRGBC, desc19);

    var idsolidColorLayer = stringIDToTypeID ("solidColorLayer");

    desc17.putObject (idT, idsolidColorLayer, desc18);

    executeAction (idsetd, desc17, DialogModes.NO);

    Returns true

    } catch (e) {return false;}

    };

    function to get the date.

    function timeString () {}

    var now = new Date();

    return Now.getTime)

    };

  • Is it possible to hide an already masked layer

    In my site with that there is a rather long content page... I want to make this content drop down with a custom scroller. So it should be hidden with a layer mask. Already the full page is hidden by another to do animation in it... How can this problem be solved... When I try to put the two layers (text and mask) under the main layer of marked it is not below... The text written in English seen in browser also seem to be like texts that is yet to be invented...

    You can't hide a layer mask, no.

    What you can do is to put the layers you want to be a mask that is nested inside a MovieClip

  • moving a separate layer can be done in "layers" manu?

    I'm just trying to move a layer and the minute I press the arrows to move the image, the hole group moves instead of a single layer.

    What can I do?

    Could you please post a screenshot with the relevant panels visible?

    'Automatic selection' is enabled in the Options bar?

  • Pouvez CS6 rendering of an image on a separate layer 3D?

    I expect that when I visited a 3D layer she would put the image rendered on a new 2D layer in the layers palette. But nothing is not created... There's just the picture on the screen. If I change anything to make it disappeared. I copy the image to the Clipboard and paste, first and foremost, to put the record on its own layer and make it permanent.

    Sounds really strange to me. Is there a setting that will make Photoshop rendering on a new layer immediately so I don't have to copy and paste it? Are there other options?

    Thank you!

    Darrell

    -----------------------

    Darrell,

    Unfortunately, you are right. You will need to copy the image to a new layer.

    Photoshop assumes you're rendered image because you're done. If it does in the 3D layer that you are working.

    FYI
    If you test a just framework and want to get an overview, you can make a selection and restore a small specific area.

  • Adding image on separate layer inserts in the slideshow below?

    Hi all

    I'm trying to insert an image into a rectangle on the Layer 2 by selecting the rectangle by using the Place... command in the menu.

    When I do this, the image is added as an image of hero to a slideshow on the Layer 1 below the rectangle.  This isn't what I want;  I would like the image to be independent of the slide show that I play with the effects of Parallax scrolling.

    Can someone tell me if it is possible to insert an image in the same x, area is occupied by a slide show without going through the image added to the slide show automatically?

    Hi Mistfall,

    Please lock the entire layer 1 or slide show, before placing the image.

    Lock will ensure that you do not accidentally select and change objects.

    Concerning

    Sonam

  • put a layer of drop on a separate layer

    Hello everyone,

    I export a design printed on a t-shirt, the printer asked I put shadow in the design on a clean diaper. Does anyone know how to do this?

    Object > expand appearance

  • How to hide text through layers of an image to the background layer?

    I have several layers of text I want to hide a background layer, which is a moving image.

    Text layers are displayed in chronological order to make a sentence (and I need it on several layers of positioning). The first word mask works great, but none of the other texts/masks until the end showing that they are on the lower layers and are hidden

    I also want the hidden area to be black.

    I have enclose a picture that shows what I want, but imagine every word is on a different layer, appear in the order and are surrounded black.

    Comp 2 (0-00-01-10).jpg

    Thank you!

    Text animations to reveal your text. Use the text layer as a track for the video cache. All that is required is two layers.

    If you insist to have each word on a separate layer, you need to precompose your layers of animated text, and then use the demo as a matte alpha for your video.

    Here are the basics of EI.

  • Filter effect and layer the layer in the same Style vs the separate layers

    I set a photographic image and uses both a filter effect and a layer style in the same layer to a smart object.  I want to separate the two effects in two layers, one layer has the effect of filter (Nik) and a layer is the layer style (Chromakey) (in order to merge/pixelation unmerged Nik filter effect with the smart object but keeping the layer style).  I can make two layers and move an effect without problem, but the Visual result of each effect on a separate layer is very different for these two effects in the same layer.   For all my layers blending Mode is Normal.  In the color overlay Panel, the blending mode is linear burn.

    I don't understand why the Visual result is different.  I'm not an advanced user of Photoshop, so maybe I'm missing something.  It is a trial of CS6 I use.

    Layer 1: layer style and a filter effect, stacked

    looks very different from...

    Layer 2: a layer style

    Layer 1: a filter effect

    If you want two separate layers, and then click the layer duplicated with the color overlay layer style you can try different layers, blend modes.

    For example, below is looking the same the Chromakey with linear burn on the second layer and change the blending mode of layers in Hue.

    You can also put the layer in a group and apply the layer for the group style.

    (I deleted the previous post because of the pilot error)

    Post edited by: R_Kelly

  • Is it possible to show/hide a layer in all the files in a book?

    Hello

    I have 5 catalogs organized in a book, everything is in 10 languages, each language is the separate layer. Each book has between 30 and 80 Indesign documents.

    I need to edit and print 4 of these languages and manually change the viability of layers is not a good idea for me because of the possible error.

    Is there a way to switch layers/languages to occur at the same time?

    Layer names are the same in all documents.

    Thank you in advance!

    Check out this post InDesignSecrets: http://indesignsecrets.com/forum/general-indesign-topics/any-way-to-synchronize-a-book-to-tour-onoff-couches

    (Yes the guy in the picture is me ;-)

  • Shadow on a layer separate in CS5

    What happened to the possibility of having a shadow on a separate layer? When I used 'Shade' in CS3, there is an option to have shade on a separate layer. I liked this feature. Why did remove it?

    Is there anyway that I can get the shadow on a layer separate in Illustrator CS5?

    This option was available in the dialog box remove the filter shade range and not in the dialog box to remove shadow effect. Most of the filters have been removed, probably to purge the program.

    You can use the drop shadow effect, expand its appearance in the menu object, then ungroup the object.

  • Find hide or items not visible

    Hi all

    Could you please help for below:

    1. to find him hide objects or elements not visible.

    2. turn the elements on separate layer name

    Look at the level of the layer 2 - rectangle box is not visible

    Screen Shot 2015-05-18 at 8.17.52 AM.png

    Thank you

    Siraj

    Try this,

    var myDoc = app.activeDocument;
    for (var idx = 0; idx < myDoc.allPageItems.length; idx++)
    {
        var pageItem = myDoc.allPageItems[idx];
        if(pageItem.itemLayer.visible==false)
        {
            pageItem.itemLayer = "TestLayer";//replace your layer name here
        }
    }
    
  • Can someone tell me how to show/hide multiple layers at the same time?

    Hello

    Can someone show me how to make more than one layer visible or invisible, without having to click on each separate layer? -J' have more than 100 layers in a drawing, and it is very tedious to have to click on each individual layer to hide it or show it. I just started using Photoshop elements 13, on an iMac

    Thanks for any advice.

    You can Option , click on the eye next to the thumbnail icon of the layer to hide all selected layers, but.

    Option , click New to display all layers.

    Order click to change the visibility of the selected layer switch

    To hide multiple layers, select the layers, right-click on one of the eyes, and click hide this layer

    Repeat to repeat the visible layers.

    You can also click on one of the eyes and then drag down or to hide layers and invert to make the visible layers.

Maybe you are looking for

  • Restart the external drive loop

    I'm trying to downgrade an old MacBook 13 inch (unibody), it's current run 10.11, but decided it was too system for the small laptop. Swap on the HD for those who had 10.5 and it would just keep restarting. I tried even to remove the HD and reboot on

  • video calls

    I would like to know if it is possible for capturing video of my calls, I wasn't able to do what I can instant video but want to take video of some calls

  • pxiident.ini

    I inherited a system that has 2 PXI chassis. In fact, I have 2 of these systems. They are supposed to be identical, but they were built in 2 different facilities and several years apart. I have problems on one, I'm looking for the differences between

  • Can I put multiple PDFs into a single pdf file?

    Original title: PDF to PDF Can I put multiple PDFs into a single pdf file? I have a lot of files that consists of 1 page. Is it possible so that I can put them together and print them out? Otherewise I have to press the button print 60 times.

  • Change my settings for MAPI in Windows Live Mail.

    original title: CHANGE MY MAPI SETTINGS Am running Windows 7 and just updated to update my windows live mail and now I can't get my accounting software to send emails - keeps telling me to change my settings to MAPI.  Always had to manually select Wi