A loop in the layers is slow.

Hi, so I'm doing a script that will go through all the layers of an off-line, sets the size of the layer to a width and height and export it to a separate file. I finished the script but it really really slow. I read that to access the layers of the model DOM is slow and I should use the ActionManager instead, but I can't find any documentation on the use of the ActionManager.

That's what I have so far:

OK, so now I create a document with the size I want. Copy the layer I want the current doc to the new and save the document. When I see a group I create a folder on the directory and calling the function recursively.

var refDoc;
var tempDoc;

function main(){
        refDoc = app.activeDocument;
        tempDoc = app.documents.add(500, 500, 72, "tempDoc", NewDocumentMode.RGB, DocumentFill.TRANSPARENT);
        app.activeDocument = refDoc;
        mainFolder = app.activeDocument.path + "/test";
          savetAllLayers(app.activeDocument, mainFolder);
        tempDoc.close (SaveOptions.DONOTSAVECHANGES);
}

function saveAllLayers(group, folderName){
    var groupFolder = new Folder(folderName)
    for (var i = 0; i < group.layers.length; i++){
            if (group.layers[i].typename.valueOf() === "LayerSet"){
                var groupFolder = new Folder(folderName + "/" + group.layers[i].name);
                if (!groupFolder.exist){
                    groupFolder.create();
                }
                saveAllLayers(group.layers[i], groupFolder);
            }
            else if (group.layers[i].typename.valueOf() === "ArtLayer"){
                try {
                    app.activeDocument = refDoc;
                    group.layers[i].copy();
                    app.activeDocument = tempDoc;
                    var targetLayer = tempDoc.artLayers.add();
                    tempDoc.paste();
                    tempDoc.activeLayer.resize(500, 500);
                    var options = new ExportOptionsSaveForWeb();
                    options.fomat = SaveDocumentType.PNG;
                    options.PNG8 = false;
                    options.transparency = true;
                    options.optimized = true;
                    //Export Save for Web in the current folder
                    tempDoc.exportDocument(File(folderName +'/' + group.layers[i].name +'.png'), ExportType.SAVEFORWEB, options);
                    targetLayer.remove();


                } catch (e){
                    alert("Error on layer: " + group.layers[i].name + "\n\n\n" + e.message);
                }
            }


    }
    return
}}


How can I use the ActionManager to achieve? Thank you.

I don't think that AM will help much, time to eat the operation is resizing and you can't do anything with AM to make it faster.

the only thing where the AM could help is passing by layers, than anything that I don't see how you can do it faster...

Here is a code with AM that will do what your function, I compared the time for each of them and there is a small improvement with AM in terms of time but it's not that much notable.

function {BCM_saveAsFolders (path)

refDoc1 = app.activeDocument;

var size = {w: 500, h:500};

var tempDoc1 = app.documents.add (500 500, 72, "BCM_rrrre_tempDoc1", NewDocumentMode.RGB, DocumentFill.TRANSPARENT);

app.activeDocument = refDoc1;

Var ref = new ActionReference();

ref.putEnumerated (charIDToTypeID ('Lyr'), charIDToTypeID ('Ordn'), charIDToTypeID ('Trgt'));

var aa = 0;

try {App.activeDocument.backgroundLayer} catch (Err) {aa = 1};

var count = executeActionGet (Ref), .getInteger (charIDToTypeID ('Cnt')) - aa; / / the number of layers in the document

var x, y, r = 0;

var currentFolder = new Folder (pathname);

if(!currentFolder.Exists) {currentFolder.Create ()};

for (i = count; I > = 0; i--) {/ / the recursive loop}

REF = new ActionReference();

ref.putIndex (charIDToTypeID ("Lyr"), I);

try {}

var / / desc = executeActionGet (ref);

} catch (err) {break ;}

var NomCouche = desc.getString (charIDToTypeID ('n'));

var Id = desc.getInteger (stringIDToTypeID ('layerID'));

ls var = desc.getEnumerationValue (stringIDToTypeID ("layerSection"));

LS = typeIDToStringID (ls);

var vis = desc.getInteger (stringIDToTypeID ("visible")); r

If (ls == 'layerSectionContent') {}

duplicateTotempDoc1umentAndSaveByIDX (i, (currentFolder.fullName + "/" + NomCouche), sizes, tempDoc1);

app.activeDocument = refDoc1;

}

If (ls == 'layerSectionStart') {/ / If this is the beginning of a series of layer}

currentFolder = new file (currentFolder.fullName + "/" + NomCouche);

If (! currentFolder.exists) {}

currentFolder.create ();

}

}

If (ls == 'layerSectionEnd') {/ / if it's the end of a layerSet}

var cPthStr = currentFolder.fullName.toString ();

currentFolder = new Folder(cPthStr.substring(0,cPthStr.lastIndexOf("/"))); "

}

}

tempDoc1.close (SaveOptions.DONOTSAVECHANGES);

}

function duplicateTotempDoc1umentAndSaveByIDX (idx, path, size, tempDoc1) {}

= double layer in a new document

var idDplc = charIDToTypeID ("Dplc");

var desc57 = new ActionDescriptor();

var idnull = charIDToTypeID ("null");

var ref47 = new ActionReference();

ref47.putIndex (charIDToTypeID ("Lyr"), idx);

desc57.putReference (idnull, ref47);

idT var = charIDToTypeID ("T");

var ref48 = new ActionReference();

var idDcmn = charIDToTypeID ("Dcmn");

ref48.putName (idDcmn, "BCM_rrrre_tempDoc1");

desc57.putReference (idT, ref48);

var idVrsn = charIDToTypeID ("VR");

desc57.putInteger (idVrsn, 5);

executeAction (idDplc, desc57, DialogModes.NO);

app.activeDocument = tempDoc1;

tempDoc1.activeLayer.resize (500, 500);

var options = new ExportOptionsSaveForWeb();

options.format = SaveDocumentType.PNG;

Options. PNG8 = false;

options. Transparency = true;

options. Optimized = true;

Save for Web in the folder being exported

tempDoc1.exportDocument (new file (path + ".png"), ExportType.SAVEFORWEB, options);

tempDoc1.activeLayer.remove ();

}

startTime var = new Date () .getTime ();

BCM_saveAsFolders (Folder.desktop + "/ test");

endTime var = new Date () .getTime ();

alert (endTime - startTime);

Tags: Photoshop

Similar Questions

  • loop through the layers defining the lock and visibility

    I need to loop through the layers in the active document and the value of the properties of the layer is false or true.  I tried to create a loop using a method 'for', but it doesn't seem to work. I have renounced the method 'for' because I kept running into a problem.  I have set all layers with these settings just the odd ones (2,4,6, etc.). Here is sample if it was written.

    myLayer = myDoc.layers var [2];

    myLayer.visible = false;

    myLayer.locked = true;

    myLayer = myDoc.layers var [4];

    myLayer.visible = false;

    myLayer.locked = true;

    myLayer = myDoc.layers var [6];

    myLayer.visible = false;

    myLayer.locked = true;

    myLayer = myDoc.layers var [8];

    myLayer.visible = false;

    myLayer.locked = true;

    I have 208 layers, so doing it this way would be way to long. Any help would be appreciated.

    Illustrator CC 2014 running.

    After I wrote this and tested, I saw that Carlos had already answered, but I thought that I would post it anyway. Carlos KNOWS how much I love JS... ;-)

    One difference is that, since it was not clear to me which layer you talk like layer #1, I started at the bottom of the scale.  I hope this helps.  -TT

    var aDoc = app.activeDocument;
    var lc = aDoc.layers.length;
    for (var i = 2; i <= lc; i+=2) {
        var curLayer = lc - i
        aDoc.layers[curLayer].visible = false;
        aDoc.layers[curLayer].locked = true;
    }
    
  • Scripting inDesign: Loop through the layers

    I'm doing a script that will:

    To loop through all the layers in a document.

    Add the layers unlocked in table

    Loop in this table and glue them in place on each layer.

    I don't know how to loop through all the layers.

    Here is my script (I used? to represent where would the loop through all the part of layers):

    JavaScript document

    Set up a table to keep unlocked layers

    var layercollection = [];

    Browse layers and unlocked the layercollection table

    for (i = 0;? i ++) {}

    app.activeDocument.activeLayer = app.activeDocument.layers.itemByName (?);

    If (app.documents [0] .layers.) ([i]). Locked) == false;

    layercollection.push (Layers.itemByName ([i]))

    }

    Loop in table layercollection and paste in place

    for (i = 0; i < layercollection.length; i ++) {}

    app.activeDocument.activeLayer = app.activeDocument.layers.itemByName (tl [i]);

    app.pasteInPlace (); Dough

    }

    Can someone help me complete my script.

    Thank you!

    Did you test them all your solutions in a real world scenario?

    Theoretically, it should work this way (if one ignores that a layer is invisible, too), but even without the problem of invisible layers app.pasteInPlace () prefer to paste into the original layer, if the option "Paste remembers Layers" is checked.

    So I recommend you do the following:

    var oldPasteRem = app.clipboardPreferences.pasteRemembersLayers;
    //uncheck "Paste Remembers Layers"
    app.clipboardPreferences.pasteRemembersLayers = false;
    
    for (i = 0; i < app.activeDocument.layers.length; i++) {
    
        //Maybe the user does not want objects pasted to invisible layers:
        if(app.activeDocument.layers[i].visible == true && app.activeDocument.layers[i].locked == false) {
            app.activeDocument.activeLayer = app.activeDocument.layers[i];
            app.pasteInPlace();
        };
    };
    //Restore the old condition:
    app.clipboardPreferences.pasteRemembersLayers = oldPasteRem;
    

    Uwe

  • How to loop through the layers of the children of a group with jsx?

    Need to change the name of a child layers in a group? How to get there?

    Kind regards

    Dorothy

    What is giving you problems?

    Perhaps this example can help:

    #target photoshop
    var theLayers = collectLayers(app.activeDocument.activeLayer, []);
    alert (theLayers.join("\n"));
    ////// function collect all layers //////
    function collectLayers (theParent, allLayers) {
      if (!allLayers) {var allLayers = new Array}
      else {};
      var theNumber = theParent.layers.length - 1;
      for (var m = theNumber; m >= 0;m--) {
      var theLayer = theParent.layers[m];
      theLayer.name = theParent.name + "_" + m;
    // apply the function to layersets;
      if (theLayer.typename == "ArtLayer") {
      allLayers.push(theLayer)
      }
      else {
      allLayers = (collectLayers(theLayer, allLayers))
    // this line includes the layer groups;
      allLayers.push(theLayer);
      }
      };
      return allLayers
      };
    
  • for loops with the name of the layer.

    I developed a script that checks if the layer color-101 exists in an open document.

    If the layer color-101 exists executes the block of code on layer color-101.

    If the layer color-101 are not running action Add layer color-101.

    Back at the beginning of the loop to check again

    I do it with a loop for and if statement.

    1. Why does the loop not stop when the loop count variable corresponds to the layer color-101 name variable?

    2. how the loop can return to the beginning to check again the presence of color-101 layer?


    Variable decalre

    app.activeDocument = docRef;

    var theLayer = "color-101;

    loop through the layers

    for (var i = 0; i < docRef.layers.length; i ++) {}

    the layer name corresponds to the loop variable

    If (docRef.layers [i] .name == theLayer) {}

    Execute the block of code for layer color-101

    Alert ("Layer" + theLayer + "exist.");

    }

    }

    layer color-101 was not found, enforcement action Add layer color-101

    Alert ('The' + theLayer + "' there is no layer: Run Add layer color-101 action. '");

    back at the beginning of the loop and check again


    Your loop does not actually stop to find the right layer. He is content to display the alert popup window, then continues. Also the 'not found' - part will still raise. And the comparison must be 100% equal without difference case or spaces or 'copy 12' - suffixes.

    Try something like

    Declaring variables

    app.activeDocument = docRef;

    var layer_found = false;

    loop through the layers

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

    var layer = docRef.layers [i]

    If (Layer.Name.toLowerCase (). IndexOf("case-101") > = 0) {}

    Alert ("found layer:" + layer.name);

    layer_found = true

    do what needs

    }

    }

    If (! layer_found) {}

    Alert ("Layer not found!");

    do what needs

    }

  • How to stop a clip of a loop at the end of my main timeline?

    I have searched and tried many suggestions and couldn't quite find a solution to my specific challenge.

    I use Adobe animate CC to produce HTML5 banner ads, no is put in place as a HTML5 Canvas document.

    My main timeline is 15 seconds long and any animation must stop at 15 seconds. While I have been using Flash for years I me as never any good at Actionscript.

    On one of my main calendar layers, I placed a short Clip (85 images) I'd like to loop until the end of the main timeline (356 frames).

    How to stop the Clip or more instances of the MC at the end of the main timeline?

    Any help is greatly appreciated. Thank you

    Apparently, some syntax was wrong.

    So on the last frame of the layer actions main adds on the scenario:

    This.instance - name-of-Movie - Clip.Stop ();

    It worked

  • Select only the layers highlighted?

    Is it possible to get to the level of the layers only highlight?

    For example, I want to get an object/array that contains only the layers highlighted in blue:

    Screenshot 2015-12-20 21.40.27.png

    I'd rather not select the work to achieve this.

    Thank you!

    M

    This gives a shot.

    It will leave you with a table containing the layers you had selected in the layers panel when the script is run.

    You can see the bottom I loop this table so you can see each name and origin of visibility

    function get_selected_layers(){
        var doc = app.activeDocument;
        var lays = doc.layers;
        var OriginalLayers = [];
        for(var i = 0; i < lays.length; i++){
            OriginalLayers.push(lays[i].visible);
            if(!lays[i].visible){
                lays[i].visible = true;
            }
        }
    
        make_action();
    
        var SelectedLayers = [];
        for(var i = 0; i < lays.length; i++){
            if(lays[i].visible){
                SelectedLayers.push(lays[i]);
            }
        }
    
        for(var i = 0; i < lays.length; i++){
                lays[i].visible = OriginalLayers[i];
        }
    
        return SelectedLayers;
    
        function make_action(){
            // Set you action name and the set name that it belongs to here
            var myAction = "Select_Layers";
            var mySet = "Scripted_Actions";
            //---------------------------------------------------------------------------------
            var currentInteractionLevel = app.userInteractionLevel;
            app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
            var actionStr = [
                '/version 3',
                '/name [ 16',
                '53637269707465645f416374696f6e73',
                ']',
                '/isOpen 0',
                '/actionCount 1',
                '/action-1 {',
                '/name [ 13',
                '53656c6563745f4c6179657273',
                ']',
                '/keyIndex 0',
                '/colorIndex 0',
                '/isOpen 0',
                '/eventCount 1',
                '/event-1 {',
                '/useRulersIn1stQuadrant 0',
                '/internalName (ai_plugin_Layer)',
                '/localizedName [ 5',
                '4c61796572',
                ']',
                '/isOpen 0',
                '/isOn 1',
                '/hasDialog 0',
                '/parameterCount 3',
                '/parameter-1 {',
                '/key 1836411236',
                '/showInPalette -1',
                '/type (integer)',
                '/value 7',
                '}',
                '/parameter-2 {',
                '/key 1937008996',
                '/showInPalette -1',
                '/type (integer)',
                '/value 23',
                '}',
                '/parameter-3 {',
                '/key 1851878757',
                '/showInPalette -1',
                '/type (ustring)',
                '/value [ 11',
                '48696465204f7468657273',
                ']',
                '}',
                '}',
                '}'
            ].join('\n');
            createAction(actionStr);
            app.doScript(myAction, mySet, false);
            actionStr = null;
            app.unloadAction(mySet,"");
            app.userInteractionLevel = currentInteractionLevel;
        }
    
        function createAction (str) {
            var f = new File('~/ScriptAction.aia');
            f.open('w');
            f.write(str);
            f.close();
            app.loadAction(f);
            f.remove();
        }
    }
    
    var myLayers = get_selected_layers();
    for(var i = 0; i < myLayers.length; i++){
        alert(myLayers[i].name + ", " + myLayers[i].visible);
    }
    
  • Script to change the selected layer to one of the drop-down list in the layers palette colors

    Hello!

    I was wondering if anyone knows of a script that would allow me to change the selected layers (single or multiple selection) in 'Light Blue' or all the colors in the menu drop-down? (see attached screenshot)

    I found the following but it changes all layers and is the RGB color.

    -----

    say application "Adobe Illustrator"

    set current_Layer in current document

    view the dialog box "in the current document there is" & layersCounter & "layers." & "Recolor label layers?"

    Repeat until (layersCounter = 0)

    set color of layer layersCounter in the current document to {Light Blue}

    set layersCounter to layersCounter - 1

    end Repeat

    end say

    -----

    Screen Shot 2015-06-12 at 10.46.46 AM.png

    I don't know how the script so any help is greatly appreciated. Thank you in advance!

    John

    as far as I can tell this is only possible with a few other modifications... Since 'selected' is not a property of "layers" javascript cannot determine if you see a highlighted layer in the layers panel.

    you could do one of 2 ways. Depending on how many layers you want to change the color, you can either make those visible or hidden (for example, if you want to change to 80% of the layers of a specific color, hide others 20%). and then simply add a clause inside the loop if for.

    var doc = app.activeDocument;

    var layers = doc.layers;

    Blue of var = new RGBColor();

    Blue.Red = 79;

    Blue.Green = 128;

    Blue.Blue = 255;

    for (i = 0; i<>

    If (layers [i] .visible == true) {}

    var = aLay layers [i];

    aLay.color = blue;

    }

    }

  • After a slower to Retiming Effects? reversing the clamp is slower that make it real

    Hi just a request, really.

    So far it seems 2014 is faster, more optimised, making it generally more quickly than the cc on the same machine

    I just made a movie of 1080 x 5760 1 minute. It has a grid of 100 scripted or more of precomps who move, expand and are expressed in remapped time.

    I made out in 25 minutes, defining it as proxy for use in a model that comes it reverses. (ctrl + alt + r)

    It's in the Middle, to 30 minutes.

    that is weird and annoying.

    Have tried with re - import the clip, when setting proxy did not work.

    And drains and clear cache

    and restart

    I should perhaps take the rendering for the first and reverse it. I still don't trust the bicubics, although you might share on applications now, I don't know.

    In 15 years never seen this before. But then I didn't do that many large frame film size so maybe it's just that.

    Although BMD 10bits rendering to a comp. 8-bit, once again, a little ridiculous. but thought it would be faster, should have stuck to the RGB8bit Animation.

    Am also new on PC and the joy of slow crash quicktime and gamma spannered ProRes etc. But the thought of the server 32-bit quicktime shnizzle work now...

    Rendered to DPX then BMD or ProRes compilation (with PRHelper - I don't no need to spend any retention HQ) all in 16-bit, but I'm trying to save time.

    CC2014, Windows7 Z820, 2xE5-2643 4x3.3ghz each, 64 GB RAM, K5000, Vertex 3 system drive. Images and rendering on 2xstriped 512GB 840Pros.

    Let's talk about time, which overturned a first layer. If you have a clip which is 30 seconds long and you've cut this clip in 4 seconds and you time reverse the layer it'll take about 4 times more time to render or preview ram such that she would be when rendered normally. It is because the time remapping effect is the calculation of the length of the fastener and the current frame whenever it renders a new image. It takes a lot of time. If apply you the same clip of time remapping and then use the wizard image key at the same time reverse the keyframes so these recalculations of waisting time disappear and each image is defined by the key frame data. Renders will reach approximately the same speed that make the clip without effects or transformations. I don't remember when I used last time reverse layer. It has been working like this for as long as I can remember. Maybe it's time for a request of feature or a bug report to find someone of the AE team to re-do the math behind the effect.

    Another thing that might slow your render is the size of the model. A great movie to a standard size entirely not made. I would make something like this in a sequence of images. Secondly, you said that you have a grid of 100 pre comps. How big are they? If you put 100 comps across before who are full HD down to fill your computer then you ask AE to treat 100 HD layers by image and make these interpretations. Rendering will take a long time. If you take the scaling down, movement and other effects on expatriation flipping a layer you are in some seriously long travel times.

  • When to use the cursor for loop and the cursor (open, fetch, close)

    Hello world
    I have a small doubt about when to use the cursor for loop and when to use the cursor for loop and the cursor (open, fetch, close).
    Well, I'm not the difference between implicit and explicit cursor. So please tell me how I got to know, what to use and when?




    Kind regards
    BS2012

    Published by: BS2012 on January 29, 2013 12:15

    All SQLs are analyzed, stored and executed as cursors. Thus, you will always use a cursor.

    The problem is that languages, such as PL/SQL, provide different interfaces to interact with the SQL cursor. As the ref, the slider interface, the interface DBMS_SQL slider interface and so on.

    Each of these interfaces offers different features. For example, using the interface DBMS_SQL allows binding dynamics and dynamic recovery. The Ref Cursor interface allows your code PL/SQL pass a handle to a reference pointing to the SQL cursor, to an external client. Etc.

    The fundamental reason for the use of an explicit cursor interface is mainly that you own and manage bulk made extraction output provided by PL/SQL cursor.

    With a cursor FOR , the motor loop of PL/SQL optimize the loop by extracting block a 100 lines both. However, you cannot access this collection in bulk directly inside the loop.

    With an explicit cursor interface, you specify the size of the extraction in bulk via the clause LIMIT , and you set the variable of collection to use. This allows you to use the collection directly variable inside the loop.

    However, the need to do - code manually in bulk collection - rarely occur in the daily programs in PL/SQL. A line of treatment is both slow and not well fits. And even if your bulk code collects lines, these lines must still be processed one at a time in your code. It is much more efficient and scalable rather write SQL code, and make the engine SQL the line of treatment for you.

  • Loop through the objects - test links

    Hello

    I have a script that moves all instances of an object linked according to the defined user X, the values of Y.

    To do this, I need to loop through all the objects with links

    What is the best way to do it?

    From now on, that's what I do:

    var g = myDoc.allGraphics;
    for (var i=0; i<g.length; i++) {
         if (g[i].itemLink.name == USER_LINK) {
              g[i].parent.move(undefined, [USER_X, USER_Y]);
         }
    }

    It works well, however, I ran into a few problems where the link is null

    Also, is it always the graph linked, or its parent may be related as well?

    If not, then I can just condition that if itemLink == null - continue

    Advice and guidance would be much appreciated

    Thank you

    David

    It works well, however, I ran into a few problems where the link is null

    if (g[i].itemLink && g[i].itemLink.name == "USER_LINK")     //     should be enough
    

    Also, is it always the graph linked, or its parent may be related as well?

    Graphics can be linked to the ==> itemLink ! = null and itemLink.status may vary

    or stuck ==> itemLink == null.

    As much as I know the graphic.parent may not be related.

    However not all are related graphic.parent can be moved. I e. those who are anchored with

    AnchorPosition.INLINE_POSITION and AnchorPosition.ABOVE_LINE

    Above the case can be a source of error as well.

    Also consider locked object or the layers locked together.

    Jarek

  • merge the layers with their filters?

    Hey Hello,


    Is there a method in Flash cs6, we could merge with filters layers?

    I posted some filters (shadow / light/etc.) to several clips in my flash design.

    Now if I select ' Direct/Cpu' rendering mode, the speed will significantly slow down.

    If I select the "GPU" rendering mode, the speed is perfect, but I lose all the effects (shadows, glows, etc..)


    What is the best solution in this case?

    In Adobe Photoshop , there is an option (The rasterize Layer Styles) to merge the layers with all styles.


    Is there a similar option in Adobe Flash to merge video clips with filters?


    Thank you very much

    You can use a bitmapdata object to create a bitmap image of your movieclip not transformed (using the draw method) and use the applyfilter method to apply a filter to your bitmapdata object.

  • Error in the labelling of the layers

    Hello world!

    I want to create a script that could analyze everything stabilized footages in my computer and

    based on the value of the "automatic" scale, he tagged every image with custom colors.

    This is the user interface of the script.

    19.05.png

    So the problem is on channel 77: comparison is not successful. Isaid that the first "If" statement 135 > 120 does not work and error alerts.

    Even when I swap > to < labelling does not work.

    var pal = new Window("palette","Stabilization Analyzer",[0,0,300,200]);
    pal.solidBt = pal.add ("button", [100,175,200,195],"Analyze");  // button "Analyze"
    
    
    pal.Al = pal.add ("StaticText", [10,10,100,30],"Auto-scale"); // text "Auto-scale > "
    pal.Al = pal.add ("StaticText", [235,10,290,30],"Then colour"); // text "Then Colour "
    
    
    /*Auto-scale text Inputs*/
    pal.num1 = pal.add("EditText",[10,30,60,50],"120");
    pal.num2 = pal.add("EditText",[10,60,60,80],"130");
    pal.num3 = pal.add("EditText",[10,90,60,110],"140");
    pal.num4 = pal.add("EditText",[10,120,60,140],"150");
    
    
    /*Label colours text Inputs*/
    pal.color1 = pal.add("EditText",[235,30,290,50],"1");
    pal.color2 = pal.add("EditText",[235,60,290,80],"2");
    pal.color3 = pal.add("EditText",[235,90,290,110],"3");
    pal.color4 = pal.add("EditText",[235,120,290,140],"4");
    
    
    
    
    pal.solidBt.onClick = analyzeBt_OnClick;  
    
    pal.center();
    pal.show();
    
    
    
    // Analyzing comp
    function analyzeBt_OnClick()
    {
    
    
    var myComp = app.project.activeItem;
        for (var i = 1; i <= myComp.numLayers; i++) {                                       // Selecting all layers of the composition
    
    
    var myName = myComp.layer(i);                                                                   // our layers
    var myEffect = myName.property("Effects").property("Warp Stabilizer");          //  we are interesdet in "Warp Stabilizer: effect 
    var myName = myEffect.property("ADBE SubspaceStabilizer-0017").name;       //  getting "Auto-scale (%number%)"  header from "Warp Stabilizer"
    var numIdx = myName.indexOf("(");
    
            if (numIdx > -1){
                    var myPct = parseFloat(myName.substr(numIdx+1));                    // parsing that %number% from "Auto-scale"   
    
                    alert (myPct);    // ---------- here I receive four values from my test footages (three times 135 and once 107)--------
            }else{
        alert("No percentage found.");
        }
    }       
    
    
    
    
    /*Text inputs "Auto-scale" variables*/
    
    
    var myStab1=parseFloat(pal.num1.text);
    var myStab2=parseFloat(pal.num2.text);
    var myStab3=parseFloat(pal.num3.text);
    var myStab4=parseFloat(pal.num4.text);
    
    
    /*Text inputs "Then color" variables*/
    
    
    var myLabel1=parseFloat(pal.color1.text);
    var myLabel2=parseFloat(pal.color2.text);
    var myLabel3=parseFloat(pal.color3.text);
    var myLabel4=parseFloat(pal.color4.text);
    
    
    
    
     // I don`t know why, but it says that first "if" statement 135 > 120 doesn`t work alerts an error.
    
    
    if (myPct > myStab1) {                          //  comparing "Auto-scale (%number%) with text inputs"
                   myName.label = myLabel1;    //  if true, applying  labels to our layer
    } else if (myPct > myStab2) {
         myName.label = myLabel2;
    } else if (myPct > myStab3) {
         myName.label = myLabel3;
    } else if (myPct > myStab4) {
         myName.label = myLabel4;
    } else {
         alert("Error! No labels applied!");
    }
    
    
    }
    
    

    I think one of the biggest problems is that you used the myName variable to store the layer and then reused to store the name of effect, so by the time you tried to apply the label you were trying to apply the name of the effect. I also imagine that labels must be applied on a per layer basis, which means that the bottom if instructions should actually be inside your loop of model layers.

    This should be a little closer to what you are after. If you haven't done so already, be sure to enable the javascript debugger in EI General prefs, because in this way, you will get errors that will help understand you what you're doing wrong.

    Here's a question for you... How do you put your code in an area you want to keep the formatting?

    var pal = new window ('pallet', 'Stabilization Analyzer', [0, 0, 300, 200]);

    pal.solidBt = pal.add ("button", 100, 175, 200 (195) and "Scan"); button "analyse".

    PAL. Al = pal.add ("StaticText', [10, 10, 100, 30], 'AutoScale'); text "" AutoScale > "."

    PAL. Al = pal.add ("StaticText", 235, 10, 290 (30) and then "color"); text 'then the color '.

    / * Text autoscaling entered * /.

    PAL.num1 = pal.add ("EditText", (10, 30, 60, 50) and "120");

    PAL.num2 = pal.add ("EditText", (10, 60, 60, 80) and "130");

    PAL. NUM3 = pal.add ("EditText", 10, 90, 60 (110) and "140");

    PAL. NUM4 = pal.add ("EditText", 10, 120, 60 (140) and '150');

    / * Color of the label text entered * /.

    PAL.color1 = pal.add ("EditText", 235, 30, 290 (50) and "1");

    PAL.color2 = pal.add ("EditText", 235, 60, 290 (80) and "2");

    PAL.color3 = pal.add ("EditText", 235, 90, 290 (110) and "3");

    PAL.color4 = pal.add ("EditText", 235, 120, 290 (140) and "4");

    pal.solidBt.onClick = analyzeBt_OnClick;

    PAL. Center();

    PAL. Show();

    Analyzing the layout

    function analyzeBt_OnClick() {}

    / * Text entered "Auto scale" variable * /.

    var myStab1 = parseFloat (pal.num1.text);

    var myStab2 = parseFloat (pal.num2.text);

    var myStab3 = parseFloat (pal.num3.text);

    var myStab4 = parseFloat (pal.num4.text);

    / * Text entered variable 'then the color' * /

    var myLabel1 = parseFloat (pal.color1.text);

    var myLabel2 = parseFloat (pal.color2.text);

    var myLabel3 = parseFloat (pal.color3.text);

    var myLabel4 = parseFloat (pal.color4.text);

    var app.project.activeItem = myComp;

    for (var i = 1; i)<= mycomp.numlayers;="" i++)="" {="" selecting="" all="" layers="" of="" the="">

    myLayer var = myComp.layer (i); our layers

    var myEffect = myLayer.property("Effects").property ("stabilizer Warp"); We are interesdet in "stabilizing Warp: effect."

    If (myEffect! = null) {}

    var MyName = myEffect.property("ADBE_SubspaceStabilizer-0017").name;

    var numIdx = myName.indexOf ("("); ")

    If (numIdx >-1) {}

    var myPct = parseFloat (myName.substr (numIdx + 1)); analysis that «Auto-scale» %nombre%

    Alert (myPct); -Here I get four values of my footages of test (135 three times and once 107)-

    If (myPct > myStab1) {/ / comparing "Auto scale (%nombre%) with text entries"}

    myLayer.label = myLabel1; If true, the application of labels to our layer

    } ElseIf (myPct > myStab2) {}

    myLayer.label = myLabel2;

    } ElseIf (myPct > myStab3) {}

    myLayer.label = myLabel3;

    } ElseIf (myPct > myStab4) {}

    myLayer.label = myLabel4;

    }

    }

    } else {}

    Alert ("no percentage found.");

    }

    }

    }

  • Need animation to loop once, several layers

    I'm new to Flash and cannot find a solution in a search.  I have a file Flash 3 layers.  The bottom layer has a static JPG.  The 2nd layer has a shape tween.  The top layer is an MP3 audio clip. If I do just a preview in Flash, it seems, runs once, just what I want.  But if I export as SWF, it performs a loop continuously.

    I also tried to put a stop(); in the last frame of each layer.  None of these combos worked.  If I then exported as SWF, it runs the audio layer once and kill animation of the 2nd layer altogether.

    How to export just this ting as SWF, loop once, with audio and animations of each layer?

    (screenshot of my work attached)

    Get rid of any stop() command, that you may have added so far.  Create a 4th layer before all the rest and add a keyframe at the end where the rest of the layers are finished.  In that last picture of key frame, add a stop(); command.  See what ends up doing.

  • How to choose among the layers

    I created a Keynote slide with several layers. Because the layers overlap or cover each other, how can I select a layer that is under one or more other layers if I want to organize or edit? Is it possible to see all the layers included on a given slide in order to choose the one I want to work on?

    I use Keynote 7.0 on macOS Sierra on a MacBook Pro.

    Thank you!

    option 1

    Click on the top layer of the set of objects to select, then press the button SHIFT and then on the tab on the keyboard to move to the bottom of the layer, press the tab key to move the layers

    option 2

    If your objects have an attached building you will see the object selected in the build order list

    If there is no attached effects, temporarily add an effect (blur has the least to impact on objects or melted)

    Inspector > animate > build order

    Click the object in the list of construction required to select:

Maybe you are looking for