release all transparent strokes on a layer with javascript

Hi all!

I'm doing a script that converts groupitems pathitems on a layer. I found a script here, which dissociates to group items in a layer.

var thisDoc = app.activeDocument;

myLayer var = app.activeDocument.activeLayer;

Var thisDoc.activeLayer.groupItems = group;

for (d = 0; d < group.length; d ++) {}

var mygroups = Group [d];

for (i = mygroups.pageItems.length - 1; i > = 0; i--)

mygroups.pageItems [i] .move (myLayer, ElementPlacement.PLACEATBEGINNING);

}

Is there a way to also release traces transparent in the group items so that they become individual pathItems as well?

Thank you

It's what you want.

function test(){

    function dismantle(group){
        var prnt = group.parent;
        var cont = (group.typename == 'CompoundPathItem') ? "pathItems" : "pageItems";
        var insertIdx = (function(){
            var ln = prnt.pageItems.length;
            for(var i=0; i-1; i--){
            var item = group[cont][i];
            item.move(insertIdx, ElementPlacement.PLACEAFTER);
        }
    }

    function breakUpLayer(layer){
        while(layer.groupItems.length>0 || layer.compoundPathItems.length>0){
            var groupIdx = layer.groupItems.length-1;
            while(groupIdx>-1){
                dismantle(layer.groupItems[groupIdx]);
                groupIdx--;
            }

            var compIdx = layer.compoundPathItems.length-1;
            while(compIdx>-1){
                dismantle(layer.compoundPathItems[compIdx]);
                compIdx--;
            }

            redraw(); //hate to do this, but items.lengths do not update otherwise.
        }
    }

    if(app == "[Application Adobe Illustrator]" && app.documents.length>0){
        var doc=app.activeDocument;
        var firstLr = doc.layers[0];

        breakUpLayer(firstLr);
    }
}

test();

I think the only problem you might encounter is the eccentric way Illustrator allows groups inside the CompoundPaths.  Crazy, no, because CompoundPathItem is not a property GroupShapes or PageItems, if you can get them using the method above.  In fact, it can get stuck in an infinite loop when it is like that!
Really, this problem must be pretty RARE because nobody should be groups into transparent paths.  But for safety it is best connected the ETSK, then you can stop debugging, if such a problem occurs.  You can also build a security counter to get out you of the loop.  What a freak!

Tags: Illustrator

Similar Questions

  • "import as layer" with javascript?

    Hello!

    I was wondering if there is one here who could give me some batch processing javascript in Acrobat tips. My problem is the following... I have many (thousands) of pdf that have an object on a layer with incorrect data. In Illustrator, I wrote a script which allows to reconstruct this object fills with correct data from a csv file and then saves in a pdf file with a name that matches the master pdf, in that it must be inserted.

    What I want to do with a batchscript of javascript is for each open file is to find the file name and the newly created pdf file is found (done) then do something equivalent to the command "import as layer" and import to an existing layer already in the main PDF so the new masks the old object. This I can't do... Well, really, I can't do a lot with js in acrobat for that matter. I can't even a var to return a value to the colsole for testing. It returns no "defined."

    I can find the layer I need to manipulate with ' this .getOCGs () [0] ", the layer I need to handle reaches zero and using the"Merge layers"example in the Guide scripts JavaScript Acrobat a layers properties are modified to match the target layer but it always appears as a distinct physical layer.

    What I just wrote is unable to make sense of bones of bunch so in other words... What I want to do with javascript, it is the action of the "Import under the layer" option selected in the layers panel in mirror. The function key I want to make is in the 'Options of Import' is to 'add to the existing layer.

    I appreciate any help that can be offered.

    JT

    There is much that can be done with JavaScript in Acrobat.
    As far as I know, you can add or merge a layer directly, but you can add a BCG with the addWatermarkFromFile() method.

    About the console, simply run your code and either select the name of the variable you want to examine or type it, and then press Ctrl + Enter. It displays its value. For example, if you run this code:
    var a = 2 + 5;
    one;

    The result will be "7".

  • Definition of the color layer with javascript property

    Is it possible to set the color of a layer in the layers palette using javascript?

    By default, everything appears colorless layer, but if you right-click (ctrl-click) on a layer you can change the color of red, Orange, yellow, etc..

    My question is can I do this with a script?

    I can lock a layer, modify its visibility and opacity, but I can't find a reference to this particular property.

    Any help is appreciated.

    Thank you


    Zara

    This will set the color of the active layer...

    layerColour("Violet");
    
    function layerColour(colour) {
        switch (colour.toLocaleLowerCase()){
            case 'red': colour = 'Rd  '; break;
            case 'orange' : colour = 'Orng'; break;
            case 'yellow' : colour = 'Ylw '; break;
            case 'yellow' : colour = 'Ylw '; break;
            case 'green' : colour = 'Grn '; break;
            case 'blue' : colour = 'Bl  '; break;
            case 'violet' : colour = 'Vlt '; break;
            case 'gray' : colour = 'Gry '; break;
            case 'none' : colour = 'None'; break;
            default : colour = 'None'; break;
            }
        var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
        desc.putReference( charIDToTypeID('null'), ref );
            var desc2 = new ActionDescriptor();
            desc2.putEnumerated( charIDToTypeID('Clr '), charIDToTypeID('Clr '), charIDToTypeID(colour) );
        desc.putObject( charIDToTypeID('T   '), charIDToTypeID('Lyr '), desc2 );
        executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
    };
    
  • How to evaluate the blend if settings with javascript

    Some time ago, someone in the MacIntosh forum declared their wish to use a layer result of the Layer Style mixture if parameter as a mask (for some reason any).

    "The layer of the ' this 'effect is easily converted to a mask by combining and flattening the layer and using the transparency resulting.

    «Underlying layer but the "'-setting seems harder (naturally because they depend on the content of the other layers).»

    Is there a way to get the current figures (for a RGB 32 file) blend If settings for a layer with JavaScript?

    Or is there a way to reset settings If This Layer-Blend, but leave unchanged the underlying layer settings?

    Any help appreciated.

    It seems I was mistaken. The merge options are not part of the layerEffects descriptor. At least not in CS4. There was a time where you had to use a script by Xbytor named Styles.js for the layerEffects descriptor. I tried as well, and also, she returns not all parameters of mixture.

    The Merge Options are stored as part of the Style When you save the Style as a preset or save it to disk as a .asl file. Take a look with a hex editor.

    This information has not been read in (via Styles.js) as part of the Style descriptor. I've updated Styles.js so that you can now get the mixture descriptor Options:

    http://PS-scripts.com/BB/viewtopic.php?t=2759

    X

  • Photoshop opens the dialog box when you try to fill a layer with locked transparent pixels

    This script should set the layer to lock transparent pixels and then fill the layer with a color. She is doing this, except when it is in the filling phase, it opens the dialog box fill, and you have to hit OK.

    If you omit the transparent pixel line, it works as not expected, no dialog boxes.

    Is there a way to remove the box? Or I'm doing something wrong, which is causing the box to open?

    #target photoshop
    app.bringToFront();
    
    doc = app.activeDocument;
    doc.artLayers[0].isBackgroundLayer = false;
    doc.artLayers[0].transparentPixelsLocked = true;
    app.activeDocument.selection.fill(app.foregroundColor); 
    

    Not sure why this is happening.

    But I would recommend blocking the above and using the AM code for a fill that pays tribute to transparency.

    #target photoshop

    app.bringToFront ();

    doc = app.activeDocument;

    doc.artLayers [0] .isBackgroundLayer = false;

    doc.activeLayer = doc.artLayers [0];

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

    idFl var = charIDToTypeID ("Fl");

    var desc18 = new ActionDescriptor();

    var idUsng = charIDToTypeID ("Usng");

    var idFlCn = charIDToTypeID ("FlCn");

    var idFrgC = charIDToTypeID ("FrgC");

    desc18.putEnumerated (idUsng, idFlCn, idFrgC);

    var idOpct = charIDToTypeID ("PCT");

    var idPrc = charIDToTypeID ("#Prc");

    desc18.putUnitDouble (idOpct, idPrc, 100.000000);

    TSM var = charIDToTypeID ("Md");

    var idBlnM = charIDToTypeID ("BlnM");

    var idNrml = charIDToTypeID ("Nrml");

    desc18.putEnumerated (TSM, idBlnM, idNrml);

    var idPrsT = charIDToTypeID ("PrsT");

    desc18.putBoolean (idPrsT, true);

    executeAction (idFl, desc18, DialogModes.NO);

  • I place a psd file with transparent background on another layer in my InDesign document. The b layer

    I placed a psd file with a transparent background on another layer in my InDesign document. The layer below has a color (RGB). When the psd file is placed, it changes the color on the layer below. I tried other psd files thinking that something is wrong with my file, but get the same result. I tried for days to figure this. Can someone help me?

    Edition > space of merger of transparency... and the changes to the Document RGB

  • How to create a transparent stroke around a picture and text

    Hello

    I want to make the transparent white line. How would I do this in CS5?

    Thank you

    Photoshop Screenshot.JPGPhotoshop Screenshot White.JPG

    Hi undlou,

    Could you please follow the steps that might help you below:

    1. Create a stroke (any color) of the appropriate size for the form for which you wish to transparent race (although it will look like this, this is not exactly what you are doing to achieve this.)
    2. Separate this race on its own layer by double clicking on the styles of the shape layer and selecting "Create layers." Skip the rest for now.
    3. Now, it is on its own layer, Cmd-click form of the trait in the layers panel, which will choose the form.
    4. Invert the selection now shift + Cmd + I or select > Inverse upstairs.
    5. Select the layer below, which you will be masking the effect of STROKE separated layer.
    6. Select 'Add a layer mask' at the bottom of the layers panel.
    7. Erase the race effect layer.
    8. To clean things up, if you want, merge this layer with the top layer and all the effects of separate layer to create a layer.

    Concerning

    Sarika

  • Transform a shape layer with several groups/paths in another?

    Hello

    I'm trying to turn the form A B-shaped into aftereffects.

    shapes copy.jpg

    Both are drawn in illustrator, and I imported into aftereffects and diverted path to forms.

    At the moment I do a key framing color and the path in the sticky on the form A and form B. From there I will meet with two questions.

    (1) for now I have to manually open each group, every path, every feature of color until I'm able to keyframe them. After that I have to paste the keyframe of the track and keyframe colors individually to the corresponding group. It's doable, but I have to turn the form in 10 more other variants. Just want to check is there a shorter way to the key all the way to access and color properties frame. And then copy all of the keyframes from one form to the other.

    Screen Shot 2016-04-21 at 2.33.34 PM.png

    (2) I noticed that not all the points on the path are created equal. I think that the "starting point" is noted with an extra box compared to other points.

    Screen Shot 2016-04-21 at 2.47.02 PM.pngScreen Shot 2016-04-21 at 2.47.14 PM.png

    As the "starting point" of a path is different from the rest, the transition has become weirdshape.gif.
    Can I check if someone knows how to change the "starting point" to another point on the same path? Or y at - it another way of fixing?

    Finally, if there is more easy morphing shapes to another, I'll be happy to listen. Thanks a lot ~

    I would do this kind of thing differently and 90% of the work in Illustrator.

    I would like to begin by drawing a path in Illustrator, to duplicate the path and to change the size and position and change the color of the outline of the color I wanted for the inside of the first form at the beginning of the animation.

    I use then the gradient tool to create a blend between the two forms specifying the number of steps, so my first form duly filled out for one frame looked like this:

    I would then do the same for my second form by using different colors, so I got this:

    With the two mixtures on you will see this:

    The upper mixing layer is where your animation will start and the bottom is where your animation should end.

    The next step is to select Merge layers and spread the mixture, if you find yourself with two groups:

    Here comes the fun part. Select groups, and then specify the number of steps you want as long as the number of images that you want in your animation. In this case, I want a second 1 transition and my comp is 29.97 FPS, so I selected 30.

    Now spread the mixture:

    We should end up with a group at layer 1 with 30 subgroups:

    Ungroup the higher group only then deselect all layers and select a single layer, then choose release to layers (sequence).

    now select all sub layers in the layer panel and drag it above layer 1. Layer 1 is now empty, so you can delete:

    Save the file HAVE and import into AE as a model with the size of the layer keeps selected:

    [Open the model, select all layers, move the a CTI frame to the right by pressing Ctrl/Cmnd + arrow to the right, then press Alt/Option +] to set the out point of all layers and then the wizard from keyframe to the layers in sequence without overlapping:

    I usually go to the point of exit of the background layer and press N to set the work area exit point, then cut the comp to work area.

    This model is then nested in your main comp and you can activate the time-remapping, so you can change the speed and use CC force motion blur to smooth animation.

    You will find it much easier to create the morph to a shape layer in Illustrator those in AE, you don't need to convert anything to forms and most of the work is done for you before you start. Total time to create this project with about 1/4 of the time it took to create this post.

  • How to subtract a grunge texture of a layer with several objects?

    Hi all

    I've been struggling with this for hours. Would be very grateful for help.

    I'm trying to apply a vintage texture to some vector illustrations.

    In the screenshot, the work I created is in the layer of "work." I tried to simplify the work as much as possible by using the union, merge, expand, etc. I wanted to do a piece of work, but that seems so simple that I can get it.

    When I try to perform a subtraction on the layer 'work' with the layer of 'texture', basically everything disappears.

    I suspect that it does not work as expected because the layer of my work is always composed of several objects and not a unified object.

    Vintage texture superimposed on the work looks good, but I need this subtraction in vector because I intend to get it printed on a shirt in one color, so I can't get the holes filled with color.

    Any help would be greatly appreciated.

    Thank you!

    Ray

    Screenshot 2016-01-28 20.10.50.pngScreenshot 2016-01-28 20.16.20.png

    How can I activate art in a single compound path?

    First of all, to unite all paths with the first button in the Pathfinder palette. Then choose object > compound path > make (or press Command-8).

    But don't do it this way. Use an opacity mask.

    If I use the grunge texture as an opacity mask, do I still to transform the art into a single compound path first or I can do to a layer with several objects as if it were now?

    No, you have not; You can keep a complete editibility of your design. You need to just design group firstly, why the opacity mask applies to all this.

    Opacity masks are easier to use if you uncheck "Clip" after their creation. Then, all parts of the mask that is black will be transparent; each part that is white will be opaque, and the things which are shades of gray will be partially transparent. Just like in Photoshop. Right now, your grunge texture is white, so you would need to change to black after making your opacity mask.

  • How to get the background color of a layer with AE SDK

    Hello

    I try to get the background color for my current layer, but I can't seem to find how do.

    I don't want background color, background color of the application, but the color that shows through, if I set the alpha of my pixels to 0.

    For example, assume that the background of the composition is black, I put a solid top, green then put a picture on top of the solid and apply my pug-in the image.

    If I set the alpha to zero in my plug-in, green solid will be displayed.

    So I want to be able to know that my background is green.

    I tried to use PF_AppGetBgColor(), but which returns the background color of the application, which isn't green in this example.

    If you want more details on what I want to do, I plug P1 which affects some 0-alpha pixels. Above it, I apply an another plugin P2 which reveals alpha-0 pixels by mixing with little color.

    What is happening now is that the output is color of the original image, mixed with the color of P2 (because only modified P1 alpha pixels).

    What I want is to have the color through the transparent pixels of P1 display mixed with the color of P2.

    To do this, I would like to be able to set the color of pixels 0-alpha in the color of the background in P1.

    Sorry for the question long.

    Thanks for your suggestions.

    Hello nicolas.

    If I understand it, that you try to get the buffer of image layers composited under the layer with your effect.

    If that is correct, then I fear that it is almost impossible to do.

    When AE makes a composition he doesn't it down. He's trying to do the opposite in fact.

    Why? because if at some point, the buffer is completely opaque, then he has no need to make what's below.

    further more, checked the diaper changing the rendering order, and many other things affect the rendering of the layers order.

    In addition, there is no API to access buffers intermediaries comp. just the end result.

    the closest you can get than without turning of the world, is to use AEGP_GetCompBGColor().

    that would be useless to you that the image is not composite on that color, unless it is the model being saved to the file.

    so why I said 'almost impossible '?

    You can transform the world.

    You can write a type ECAP 'craftsman '. (look at the example of 'arti')

    These plug-ins make comps (instead of the "advanced3D" converter)

    a craftsman has results intermediaries comp, because he is the one doing the rendering.

    so now you can have your craftsman save the buffer, you need and deliver it to your effect.

    I must warn you that this is very very very difficult.

    Another possible solution is to create a copy of the model resides in your effect,

    erase all the layers that has the image you need and make that reproduces model using AEGP_GetReceiptWorld().

    If you use this method, you must supervise the original model and apply changes to the copy.

    Yes, it's too difficult to do.

    you could make a change in the strategy and apply your effect to an adjustment layer instead.

    the entry for the adjustment layer is the buffer underlying layers.

    Then, you could get the original sources you want to treat using checked layer params.

    the last solution I can think uses the expression of sampleImage() on a hidden parameter.

    This will give you any layer's pixel data in the model, but not the composite of the underlying layers.

    Maybe if you tried sampling adjustment layers post effects... I don't know. you need to try.

    This method is very slow and is also limited to expire, so you can't get a large number of pixels.

    the expression simply fails.

    I hope that this was not all bad news for you.

    Maybe you said more about the plug-in you develop I could come up with a better plan.

    :-)

  • Cannot release all online content after upgrade to ios 9.2

    I have an iPhone 16 GB 5, which I recently upgraded to ios 9.2.

    Since the update, I can't release all content online (titles of Soundcloud, 8tracks playlists, Instagram, or youtube videos). I tried to remove or update the relevant applications and deletion of photos/videos on my phone to create storage, but nothing has worked. I also tried to broadcast the same content using Safari (i.e., going on the Web sites of soundcloud/youtube to play tracks), but that doesn't work anymore. Similarly, the podcasts app does not do anything and the content I want to disseminate through relevant Web sites of podcasts is also insensitive. Strangely enough, Spotify is only seems to work (at least for now).

    Someone has a similar problem? I went on community support issues and realized account of some people had problems with their videos of Instagram and I followed the recommended steps provided in response to these issues, but it does not work for me either.

    Could someone please help?

    Thank you very much!

    Hi guncan,

    If you are having problems with your iPhone is not not be able to play the streamed content, you can try some things to solve problems.

    First of all, quit all applications running and test again-

    Force an app to close the iOS

    Then, I would try restarting iPhone.

    Restart your iPhone, iPad or iPod touch

    Thank you for using communities of Apple Support.

    Best for you.

  • ModtDestroySessionHandle does not release all memory resources

    Hello

    I have a program that attempts to do 1000 iteriations to read the message of the RF, but I get the error "not enough memory to complete this operation" popup. Look like memory leaks about 520 iterations.

    In this loop, I ModtCreateSessionHandle (& modt_Hdl) initially inside the loop and ModtDestroySessionHandle (modt_Hdl); in the end inside the loop. I had to move both ModtCreateSessionHandle (& modt_Hdl) and and ModtDestroySessionHandle (modt_Hdl) outside the loop to solve the problem.

    Should and release all the atttached of resource memory for mod_Hdl ModtDestroySessionHandle (modt_Hdl)?

    Kind regards

    Shane

    Hiya Shane,

    Thanks for your comments. You are quite correct, the ModtDestroySessionHandle should allow you to free up internal resources and ignores the ModtHandle created using the ModtCreateSessionHandle function. To ensure the appropriate memory release, this function must be called for every ModtHandle created with the ModtCreateSessionHandle function.

    Therefore, I am surprised to hear about memory leaks you have described. However, regardless of the memory leaks, the process of constantly creating sessions (memory allocation) and destruction (deallocation of memory) is horribly inefficient.

    The solution you found yourself is a case of very typical use for modulation functions. Pulling your create and destroy calls outside the loop, you only asked once, but always refferencing the sessions in the loop.

    I will feed your comments to our R & D team, so that we publish handles and allocated memory space as carefully as possible. However, your original architecture is not an intended use function calls, and functions may not be tested in this way. My gut feeling is that maybe every time we create the handle, must have a block of contiguous memory. If there is no variation in grip size, this could cause the 'memory leak' over time. My final comment is purely speculative.

    Ultimately, by following the correct use of the functions you have improved the effecientcy stripped yopur enforcement and removed the potential memory leak.

    Thanks again for your results display.

    Best wishes and greetings,

  • Pathfinder will unite all the objects on each layer

    I wonder if anyone can help me with the script, which is unite mode form via pathfinder on all the objects on each layer.

    I manually activate a layer, pressing ctrl + a, and then clicking the shape mode button unit. Then, the layers are over 50 then, making him the great peace of time.

    Piggyback off pixxxel schubser

    function MergeAllLayers() {
        // exit early if there are no files open
        if( !app.documents.length ) return;
        var doc = app.activeDocument;
    
        // clear selection
        doc.selection = null;
    
        // loop through all layers
        var layers = doc.layers;
        for( var i = 0, ii = layers.length; i < ii; i++ ) {
    
            // select everything on the current layer
            layers[i].hasSelectedArtwork = true;
    
            app.executeMenuCommand("group");
            app.executeMenuCommand("Live Pathfinder Add");
            app.executeMenuCommand("expandStyle");  
    
            // clear selection
            doc.selection = null;
        }
    }
    
    MergeAllLayers();
    

    Equal to true, the definition of the hasSelectedArtwork layer property is a fun thing to select the entire document on a layer, you've just got to make sure to disable any other settings first.

  • Is it possible to get the layer, layerset and layer with status layerset...!

    Hello world!

    Is it possible to get the layer, layerset and layer with the status layerset. Because I met a big problem out of it.

    I have a single PS document which is contain the collection of layer, layer with layer games collection. I need apply the function for each layer and layers and each layer games with of layerset.

    I also tried a code, but its error getting. Please help me out of this code...

    -yajiv

    #target photoshop

    app.bringToFront ();

    level of $= 2;

    var app.activeDocument = docRef;

    Journal of the var ="";

    var x = 0;

    var n = number (docRef.layers.length) - 1;

    for (i = 0; i < n; i ++) {}

    var tm = String (docRef.layers [i]);

    var isLayer = tm.lastIndexOf ("ArtLayer");

    var isLayerSet = tm.lastIndexOf ("LayerSet");

    {if(isLayer!=-1)}

    Check_LayerStructure (DocRef.Layers [i], 'Layer');

    }

    {if(isLayerSet!=-1)}

    Check_LayerStructure (DocRef.layerSets, "LayerSets");

    x = x + 1;

    }

    }

    function Check_LayerStructure (objLayer, objflag, x) {------}

    {if(objflag=="Layer")}

    LayetStructure (objLayer, objLayer.name, BlendMode.NORMAL, 100, 100, 0, true, 'Layer');

    }

    else {if(objflag=="LayerSets")

    LayetStructure (objLayer [x] objLayer [x] .name, BlendMode.PASSTHROUGH, 100, 100, 1, true, 'together');

    m = Number (objLayer [x] .layers. Length)

    for (j = 0; j < m; j ++) {}

    var tm = String (objLayer [x] .layers [j]);

    var isLayer = tm.lastIndexOf ("ArtLayer");

    var isLayerSet = tm.lastIndexOf ("LayerSet");

    {if(isLayer!=-1)}

    Check_LayerStructure (objLayer [x]. Layers [j], 'Layer');

    }

    {if(isLayerSet!=-1)}

    Check_LayerStructure (objLayer [x] .layerSets, "LayerSets", x);

    }

    } / / Loop Layerset

    } / / I loop For

    } //Function loop

    function LayetStructure(layerRef,L,bMode,Opt,fillOpt,S,layVisible,Lref) {}

    {if(layerRef.BlendMode!=bMode)}

    If (confirm (L + Lref + "belend mode was bad...!)) \n"+"do you want to change...? »)) {

    layerRef.blendMode = bMode;

    Journal = Journal + "-" + L + Lref + "belend mode has been changed...! \n\n ";

    e = 1;

    }

    }

    {if(layerRef.Opacity!=opt)}

    If (confirm (L + Lref + ' opacity has been "+ Math.round (layerRef.opacity) +"%...! ")) \n"+"do you want to change...? »)) {

    layerRef.opacity = Opt;

    Journal = Journal + "-" + L + Lref + ' opacity was changed to 100...! \n\n ";

    e = 1;

    }

    }

    If (layerRef.fillOpacity! = fillOpt & & S == 0) {}

    If (confirm (L + Lref + ' Fill has been "+ Math.round (layerRef.fillOpacity) +"%...! ")) \n"+"do you want to change...? »)) {

    layerRef.fillOpacity = fillOpt;

    Journal = Journal + "-" + L + Lref + ' fill has been changed to 100...! \n\n ";

    e = 1;

    }

    }

    {if(layerRef.visible!=layVisible)}

    If (L + Lref + ' left eye...! ") \n"+"do you want to change...? ») {

    layerRef.visible = layVisible;

    Journal = Journal + "-" + L + Lref + ' eye was turn on...! \n\n ";

    e = 1;

    }

    }

    }

    Code of responsible for the action would naturally faster, but if you should be more comfortable with the DOM code, it could be useful to you.

    #target photoshop

    var theLayers = collectLayers (app.activeDocument, []);

    Alert (theLayers.join ("\n"));

    function to collect all the layers.

    function collectLayers (theParent, allLayers) {}

    If (! allLayers) {var allLayers = new Array}

    else {};

    the number of var theParent.layers.length = - 1;

    for (var m = number; m > = 0; m-) {}

    var theLayer = theParent.layers [m];

    apply the function of games of layers;

    If (theLayer.typename == "ArtLayer") {}

    allLayers.push ([theLayer, theLayer.blendMode, theLayer.opacity, theLayer.fillOpacity])

    }

    else {}

    allLayers = (collectLayers (theLayer, allLayers))

    This line includes layer groups;

    allLayers.push ([theLayer, theLayer.blendMode, theLayer.opacity, theLayer.fillOpacity]);

    }

    };

    return allLayers

    };

  • Test if a layer with a specific name exists?

    Is there a simple way to determine if there is a layer with a specific name?

    You can browse all the layers table, check if the name you are looking for is there.
    You can even put it in a function that returns a boolean, as follows:

    function doesLayerExist (layers, name) {}
    for (i = 0; i
    If (layers [i] .name == name) return true;
    }
    Returns false;
    }

    You can then call it as follows:

    If (doesLayerExist (app.activeDocument.layers, "Layer1")) {}

    do something if the layer exists

    } else {}

    do something if the layer does not exist

    }

Maybe you are looking for