Layers of parenthood by script in AE

Hi people,


I'm working on writing a script with the script toolkit extension, which creates a number of solids, positioned

in a circle and so on. Now, I want all these layers created for a controller null, for easy animation of the parents.


Of Null´s and layers are created so far. How can I connect each layer to null by parental control?


Any idea?


Andreas thx.

Assuming you have variables representing the layers, it would be just like this:

myLayer.parent = myNull;

Dan

Tags: After Effects

Similar Questions

  • Export layers of resolution change Script files

    When I run this script to save my layers as .png files it turns at 72 dpi... I need to keep 300 dpi as the original file. Is it possible to change this? Thanks in advance for any help!

    Kari Holt

    iMac OS 10.5.8

    CS4 Extended

    Open the script is a text editor. I recommend ExtendScript Toolkit that ships with Photoshop.

    Find the line png24Index:

    Highlight all between this line and the line that reads the break. Replace the code below.

            case png24Index:
                 /*
                saveFile(docRef, fileNameBody, exportInfo, dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter.value, dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans.value);
                 function saveFile( docRef, fileNameBody, exportInfo, interlacedValue, transparencyValue) {
                   var id6 = charIDToTypeID( "Expr" );
                        var desc3 = new ActionDescriptor();
                        var id7 = charIDToTypeID( "Usng" );
                             var desc4 = new ActionDescriptor();
                             var id8 = charIDToTypeID( "Op  " );
                             var id9 = charIDToTypeID( "SWOp" );
                             var id10 = charIDToTypeID( "OpSa" );
                           desc4.putEnumerated( id8, id9, id10 );
                             var id11 = charIDToTypeID( "Fmt " );
                             var id12 = charIDToTypeID( "IRFm" );
                             var id13 = charIDToTypeID( "PN24" );
                             desc4.putEnumerated( id11, id12, id13 );
                             var id14 = charIDToTypeID( "Intr" );
                             desc4.putBoolean( id14, interlacedValue );
                             var id15 = charIDToTypeID( "Trns" );
                             desc4.putBoolean( id15, transparencyValue );
                             var id16 = charIDToTypeID( "Mtt " );
                             desc4.putBoolean( id16, true );
                             var id17 = charIDToTypeID( "MttR" );
                             desc4.putInteger( id17, 255 );
                             var id18 = charIDToTypeID( "MttG" );
                             desc4.putInteger( id18, 255 );
                             var id19 = charIDToTypeID( "MttB" );
                             desc4.putInteger( id19, 255 );
                             var id20 = charIDToTypeID( "SHTM" );
                             desc4.putBoolean( id20, false );
                             var id21 = charIDToTypeID( "SImg" );
                             desc4.putBoolean( id21, true );
                             var id22 = charIDToTypeID( "SSSO" );
                             desc4.putBoolean( id22, false );
                             var id23 = charIDToTypeID( "SSLt" );
                                  var list1 = new ActionList();
                             desc4.putList( id23, list1 );
                             var id24 = charIDToTypeID( "DIDr" );
                             desc4.putBoolean( id24, false );
                             var id25 = charIDToTypeID( "In  " );
                             desc4.putPath( id25, new File( exportInfo.destination + "/" + fileNameBody + ".png") );
                        var id26 = stringIDToTypeID( "SaveForWeb" );
                        desc3.putObject( id7, id26, desc4 );
                   executeAction( id6, desc3, DialogModes.NO );
                   }
            */
                var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".png");
                pngSaveOptions = new PNGSaveOptions();
                pngSaveOptions.interlaced = false;
                docRef.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);
                break;
    

    Note that comments saveForWeb rather code that deletes it if you want to go back. Also, it removes the existing normal comment characters save the code and fix the save option used between bmp and png.

    I also recommend that you add comments to the upper part of the realization of script that you have edited the script and save it under a different name.

  • Need help to write a script that opens files, removes layers and sous-calques

    Hey all,.

    I'm a noob to the community of script, and what I try to do is file edit commands that share the same names of layers and sublayers. I have a few questions that would be incredibly useful if I could have answered.

    I'm not sure how to define a script too call out of the layers that have been created without script. I need to create a variable for the existing layers and leave the script to know what their names are in the files?

    For example, I have three files which have each layer named 'cutlayer', 'trimlayer', 'fold' and 'work '. I need to write a script that opens three files, deletes the layer 'fold' of each file, and then move the layer "trimlayer" in his own sublayer in 'work' (the base layer can be on the top so reorganization sublayers is not necessary to worry about something). I do not understand how to write the script because I couldn't find examples in the documentation for the script provided on the adobe website which has worked with existing files.

    It's my shot at what I'm trying to do, with English fill in the blanks of what I do not know how to script. If anyone can help me understand this point, I would really appreciate it!

    app.documents.openDlg (prompt, filter, MultiSelect);  the user opens the associated files

    If (documents.length > 0) //run the script through each document individually

    {

    sourceDoc = activeDocument;

    delete the "fold" sourceDoc layer

    move the "trimlayer" in the layer "work."

    remove the underlayment 'path' of layer "work."

    Run the script through each document

    Save the new file name folder in the new parallel to the current folder on the hard disk

    Go out and spend in each document until there is no more

    }

    create new document

    Place documents published in different layers in the new document, with a distance between them, optimize the space on a 51 "x 51" work plan, using as little of the artboard as possible. "

    All comments are things basically, I do not know how and am trying to figure out how to do, so if anyone has a second to explain some of these things, I would really appreciate it!

    Thanks again!

    I know it of very frustrating when his apprenticeship and things don't go as planned, but understand that it is quite confusing as it is and do not add more confusion to the mix by using other tools than those provided. I mean JSLint, it might be useful with GENERAL javascript syntax, but Adobe's Javascript implementation is another animal, or another language, always JavaScript, but intended to be run by its own engine. JSLint has no idea what "layers", or "pathItems" are, it will trigger errors when he sees the objects, it does not recognize.

    .. .in learning... not to take baby, write a single line of code and run... If it works, write another line of code

    Try this version (always in the ESTK),'re missing you a few "++", and you do not change "documents" with "docs" in a certain place

    var docs = File.openDialog("Select Files to Open", "*.ai", true);
    
    var idx = 0;
    
    for (idx = 0; idx < docs.length; ++idx) {
    
        var doc = app.open(docs[idx]);
    
        var myCounter = 0;
    
        for (myCounter = 0; myCounter < doc.layers.length; myCounter++) {
    
            doc.layers[myCounter].locked = false;
    
        }
    
        doc.layers.getByName('Crease').remove();
    
        doc.layers.getByName('Regmark').remove();
    
        doc.layers.getByName('Artwork').pathItems[0].remove();
    
        doc.layers.getByName('Through Cut').hasSelectedArtwork = true;   
    
        doc.layers.getByName('Through Cut').pathItems[0].strokeColor = doc.swatches.getByName("Black").color;   
    
        doc.layers.getByName('Through Cut').move(doc.layers.getByName('Artwork'), ElementPlacement.INSIDE);
    
    }
    
  • 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);
    }
    
  • Frames/layers consistent duplicated in gifs problem

    Hello

    I was do gifs for years, using two load files in the stack and import video frames to layers scripts. For some reason, about six months ago, I started having problems with the video image import tool.

    This has happened on both my old laptop and on my current PC.

    Basically, I over the section of the video I want and let the images to load. I use all the frames, because I love my smooth gifs. But they are still restless. The layers and images that I do from them using the timeline are duplicated. When I make a gif executives should go 123456789 etc, one after the other. But now, most of the time, they're going to 11335577. Delete the images between the two does not it - I think that some of the images are reproduced on each after.

    This tends to happen more often when I'm giffing of animation videos, like YouTube video games records. I don't really know why that is.

    I have a new computer with a card NVIDIA GTX 745, but I appreciate that it might be related to that. I searched for months for a possible solution to this, and nothing has worked. I would greatly appreciate any suggestions. I use Photoshop CC.

    Thank you very much.

    Import video Frame to layers is word a script.   However, the function is limited to importation of 500 images and much ignore frames if you look its dialog box.  GIF also has very poor colors compared to the video and poor compression compared to the video.   You may be better to create an MP4 file, it may even have audio and very probably be smaller size then the GIF that has a poor color no sound. I had to cut it to 30 framse the GIF is still 1.6 MB

    This mp4 is to linger and 1.4 MB http://www.mouseprints.net/old/dpr/bonjovi.mp4

  • by selecting all the blocks of text on all visible layers

    I want to select all the blocks of text on all visible layers.

    the script below will select all the blocks of text, even in groups, but if the layer with the text is invisible the script error. (target layer cannot be changed)

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

    var doc = app.activeDocument;

    var numTextFrames = 0;

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

    textArtRange = doc.textFrames [i];

    textArtRange.selected = true;

    }

    }

    So I made this script to select blocks of text on only visible layers, but now missing text belonging to a group.

    var layerCount = activeDocument.layers.length;

    var docSelected = activeDocument.selection;

    for (i = 0; i < layerCount; i ++)

    {

    currentLayer = activeDocument.layers [i];

    If (currentLayer.visible == visible)

    {

    for (j = 0; j < currentLayer.textFrames.length; j ++) {}

    textArtRange = currentLayer.textFrames [j];

    textArtRange.selected = true;

    }

    }

    }

    can someone tell me why it is not some frames of text bound in a group when made this way and is it possible to get all managers of related texts selected on all visible layers?

    Thank you

    Duane

    Try this:

    if (app.documents.length > 0 ) {
        var doc = app.activeDocument;
        var numTextFrames = 0;
        for (  i = 0; i < doc.textFrames.length; i++ ) {
            try {
            textArtRange = doc.textFrames[i];
            textArtRange.selected = true;
            } catch (e) {}
            }
        }
    

    Have fun

  • Need help with a script of Fade Transitions

    I'm new to scripting so apologies if I've made a few obvious mistakes.

    In addition, do not know if there is already a feature in AE I don't know which will achieve

    what I'm trying to do, but I want to learn AdobeExtendScript and thought it was a great app for a script.

    I am trying to write a script allowing to adjusts video layers and opacity of the image key fades from 100% to 0% on a

    length of the frameworks determined by the user. Nothing too crazy. I've tested this script with imported parts of first and

    It works, kind of, but only when the first layer in the model is part of the selected layers.

    Here's the script:

    //

    fadeTransitions.jsx (03/12/12)

    Copyright © 2012 Paul Kelly for Perioperative Interactive education. All rights reserved.

    http:pkvisualization.com

    // http://pie.med.utoronto.ca

    //

    This script will be set a series of layers so that the layer opacity fades

    from 100% to 0% over a length of frames determined by the user.

    //

    var theComp = app.project.activeItem; the value of a variable equal to the active composition

    If (theComp == null |) (theComp instanceof CompItem) == false) / / check if the item is selected and make sure it is a CompItem

    {

    Alert ("you must have at least two selected layers");

    } else {}

    var numberOfLayers = theComp.selectedLayers.length; the value of a variable equal to the total number of selected layers

    If (numberOfLayers == null: numberOfLayers < 2) / / make sure there are at least two selected layers

    {

    Alert ("you must have at least two selected layers");

    } else {}

    var startLayer = prompt ("first layer to be affected:", "layer #");

    you want to remove this prompt and set a variable for the above selected layer.

    var startLayer = theComp.selectedLayers [0]; does not work. I want the lowest layer indexed multiple selected layers

    fadeTransitions();

    } //end second otherwise: numberOfLayers test

    } //end first thing: theComp test

    function fadeTransitions()

    {

    app.beginUndoGroup ("FadeTransitions");

    var overlap = parseInt (command prompt ("specifies the length of the fade-off (frames)", "0" "));

    overlap overlap = * theComp.frameDuration;

    for (var i = 1; i < = numberOfLayers; i ++)

    {

    var layerIndex = (startLayer - 1) + i; create the layer index, subtract 1 for compensation of the correct layer

    If (layerIndex > numberOfLayers) {//end before layerIndex becomes more than numberOfLayers

    Alert ("Transitions Fade script');

    break;

    } else {}

    var topLayerEnd = .outPoint theComp.layer (layerIndex);

    If ((layerIndex+1) > numberOfLayers) {//end before (layerIndex + 1) becomes more than numberOfLayers

    Alert ("Transitions Fade script');

    break;

    } else {}

    var btmLayerStart = theComp.layer(layerIndex+1).inPoint;

    var btmLayerEnd = theComp.layer(layerIndex+1).outPoint;

    term var = btmLayerEnd - btmLayerStart;

    theComp.layer(layerIndex+1).inPoint = (topLayerEnd - overlap);

    theComp.layer(layerIndex+1).outPoint = (topLayerEnd + duration);

    theComp.layer (layerIndex).opacity.setValueAtTime ((theComp.layer (layerIndex) .outPoint - overlap), 100);

    theComp.layer (layerIndex).opacity.setValueAtTime (theComp.layer (layerIndex) .outPoint, 0);

    } //end 2nd else

    } //end 1 else

    } //end for loop

    app.endUndoGroup ();

    } //end fadeTransitions function

    #1 problem: I want to eliminate the prompt asking the startLayer, instead, I want the first layer to be the highest of

    a selection of layers, so that at any time, you can select a series of layers and run the script only affect these layers.

    I tried to do this by setting a variable app.project.activeItem.selectedLayers [0]; but it did not work. This function would be really

    required during the later stages of compositing, when there are a lot of layers of subtitles, audio, 3D rendered images, etc. above

    layers of film in the model.

    #2 problem: unless the selected layers are pre-established way cascading, I get some really weird adjustments to the in-

    and outPoints. Not sure what is the cause. This isn't a priority, because most of the time I want to use this script layers

    will be already prepared properly (I import a Premiere Pro sequence), but still, I would like to know how I could solve this problem

    and to better understand how works ExtendScript.

    Problem #3: Right now, the way that these guys down inPoints are adjusted, is the same as if I flew over the inPoint layer with the mouse and

    got horizontally in line with the arrows of face to face and click-slipped the inPoint backward, but what I prefer is the

    equivalent of if I fly in the middle of the layer from the Selection tool and click-and - drag the entire layer L or R, so that it is inPoint

    is always in the same place in the sequence. As problem #2, it is not a great problem, I just want to better understand what is happening

    in the script. I tried to use startTime instead of inPoint in the script, but then it just stopped working completely.

    Any help/ideas would be greatly appreciated, and everyone feel free to use what I have so far if you wish.

    This give a try. I have not tested much, but I think it's pretty close to what you are after. It is not as limited to a selection of contiguous layers.

    //

    fadeTransitions.jsx (03/12/12)

    Copyright © 2012 Paul Kelly for Perioperative Interactive education. All rights reserved.

    http:pkvisualization.com

    http://pie.med.utoronto.ca

    //

    This script will be set a series of layers so that the layer opacity fades

    from 100% to 0% over a length of frames determined by the user.

    //

    var indexArray = new Array();

    var theComp = app.project.activeItem; the value of a variable equal to the active composition

    If (theComp == null |) (theComp instanceof CompItem) == false) / / check if the item is selected and make sure it is a CompItem

    {

    Alert ("you must have at least two selected layers");

    } else {}

    var numberOfLayers = theComp.selectedLayers.length; the value of a variable equal to the total number of selected layers

    If (numberOfLayers == null: numberOfLayers)< 2)="" make="" sure="" there="" are="" at="" least="" two="" layers="">

    {

    Alert ("you must have at least two selected layers");

    } else {}

    "selectedLayers" is based on the order of selection, need a different approach to ensure that we are working from top down

    make an array of the indices of layer

    for (var x = 0; x)< numberoflayers;="" x++)="">

    indexArray.push (theComp.selectedLayers [x] .index);

    }

    sort the indexArray

    indexArray.sort ();

    var startLayer = indexArray [0];

    fadeTransitions();

    } //end second otherwise: numberOfLayers test

    } //end first thing: theComp test

    function fadeTransitions()

    {

    var overlap = parseInt (command prompt ("specifies the length of the fade-off (frames)", "0" "));

    If (overlap == null) return; If the user has canceled guest

    overlap = parseInt (overLap);

    If (isNaN (overLap)) return;          If the user does not enter the number

    app.beginUndoGroup ("FadeTransitions");

    overlap overlap = * theComp.frameDuration;

    var layerIndex, topLayerEnd, btmLayerStart, btmLayerEnd, duration, startTimeOffset;

    for (var i = 0; i)

    {

    layerIndex = indexArray [i];

    topLayerEnd = .outPoint theComp.layer (layerIndex);

    If (i + 1< numberoflayers)="" {="" end="" before="" (layerindex+1)="" becomes="" more="" than="">

    btmLayerStart = theComp.layer(indexArray[i+1]).inPoint;

    btmLayerEnd = theComp.layer(indexArray[i+1]).outPoint;

    duration = btmLayerEnd - btmLayerStart;

    need to calculate the offset if inPoint is not at the beginning of the layer

    startTimeOffset = btmLayerStart - theComp.layer(indexArray[i+1]).startTime;

    move the layer by changing startTime rather than inPoint

    theComp.layer(indexArray[i+1]).startTime = (topLayerEnd-overlap - startTimeOffset);

    theComp.layer(indexArray[i+1]).outPoint = (topLayerEnd + duration);

    theComp.layer (layerIndex).opacity.setValueAtTime ((theComp.layer (layerIndex) .outPoint - overlap), 100);

    theComp.layer (layerIndex).opacity.setValueAtTime (theComp.layer (layerIndex) .outPoint, 0);

    }

    } //end for loop

    Alert ("Transitions Fade script');

    app.endUndoGroup ();

    } //end fadeTransitions function

  • Move the layers (step)

    How to move the layers selected in the script? I want to change the selected position layers (numLayers) as reverse.

    front

    http://Yadi.SK/d/8xI4ZBU40CQi5

    After

    http://Yadi.SK/d/MaJXykuN0CQiP

    Select the layers from the bottom to the top, CTRL + X (cut) and paste (CTRL + V)

    http://www.Nijdam.de/aescripts/ReverseSelectedLayerOrder.zip

  • Script to sort Images with/without clipping paths?

    I searched for a while and can not find a script that will sort a folder of images in two new folders that contain images with and without masks. Anyone have or know of a script that will do this for me? I'd be very happy. W7, PS CS5 32 and 64 bit.

    Thanks in advance!

    Andy

    Mark has made the work a lot more on what I have and it would be so worth having an eye on them.

    Mark only your layers to find together scripts?

    The script in its present form should find ways of trimming but not group layers.

    I modified the script to split the files into hasClip, hasPath and noPath of three files.

    #target bridge
     if( BridgeTalk.appName == "bridge" ) {
    clipPaths = MenuElement.create("command", "Sort Clipping Paths", "at the end of Tools","clipping");
    }
    clipPaths.onSelect = function () {
    app.document.deselectAll();
    var thumbs = app.document.getSelection("psd, tif, jpg, eps");
    var noPath = new Folder(app.document.presentationPath+ '/noPath');
    var hasPath = new Folder(app.document.presentationPath+ '/hasPath');
    var hasClip = new Folder(app.document.presentationPath+ '/hasClip');
    if(!noPath.exists)  noPath.create();
    if(!hasClip.exists)  hasClip.create();
    if(!hasPath.exists)  hasPath.create();
    for(var a in thumbs){
    var tempFile = thumbs[a].spec;
    var Path = false;
    var Clip = false;
    tempFile.encoding='BINARY';
    tempFile.open('r');
    var str= tempFile.read();
    tempFile.close();
    var pathTag = '8BIM\x07\xd0';
    var clippingPathTag = '8BIM\x0b\xb7';
    var tagPos =str.match(pathTag);
    if(tagPos){
        Path = true;
        tagPos =str.match(clippingPathTag);
        if(tagPos){
            Clip = true;
            }
    }
    str = null;
    if(!Path) thumbs[a].moveTo(noPath);
    if(Path && Clip)  thumbs[a].moveTo(hasClip);
    if(Path && !Clip) thumbs[a].moveTo(hasPath);
    }
    };
    
  • Script to update the legacy text (action does not work)

    So here is my scenario: I did everything select and update legacy text, but I have some problems with some type paths that are to be cut. OK, easy enough I would deselect these layers and run 'update text inherited selected' GREAT WORKS!

    Here is my delima I have 400 files .eps I do this on. Layer names are always the same, so I was wondering if there was an easy way to do it on an action. Is an action knows I'm if you deselect a layer after selecting all? Why it does not save when I

    Type > Legacy text > convert selected text?

    • Select all

    • Deselect two layers (layers compatible name)

    • Type > Legacy text > convert selected text

    Is it easy in a script to remove?

    What happens if you unlock the two layers before running the script?

  • Copy and paste multiple layers (with objects) of one movieclip to another

    Hey guys,.

    I'm really frustrated with myself because I believe that this should be easy.

    But I was stuck for centuries, hopefully you guys could help out me.

    I try to copy the images of 6 different layers and objects (action script, own movements tween, buttons, graphic elements) of one movieclip to another. But as soon as I did this, everyhting seems to have shifted and if I try to reposition elements in the new clip, it seems that I must repeat after each keyframe for each layer.

    So my question is

    Is a. possible to duplicate a clip, but give it an instance name (a completely new movieclip with the same frames and layers in the same position as the previous)?

    B. How can I move multiple objects through the layers and keyframes?

    I hope that makes sense.

    Thanks in advance for your help.

    M.

    A. you can create a movieclip instances just by dragging the movieclip on the stage and with actionscript library (if the movieclip is exported for actionscript).  all instances of movieclips created in this way will be identical.

    You can also right-click on a clip from the library and click on duplicate movieclip and then change the duplicated movieclip.  instances created of the split movieclip and original movieclip can be different.

    B. I do not understand your question.  I understand (I think) your problem.  to copy specific layers/frames, just shift-mousedown and drag through all layers and images you need.  Don't be shy on the inclusion of the layers and or framework you can remove the latter.  then paste it in a new movieclip.  remove the layers that you don't want.  If you remove all executives of other layers, you must remove the frame of all layers or you will have problems as you described.

  • Assign a function. onClick() to a generic/automatically created button?

    Hey scripters.

    I'm back with another scratcher of noodles. I am tempted to write a dialog script UI with a simple checkbox in the top box, and then a group of buttons below. The number of generated buttons and their text will vary from doc to doc, so I create buttons with a loop. However, because of this, I encountered a problem that I had not expected.

    I want each button to perform a function that sets the variables of a couple and then closes the dialog window. Normally, I would use:

    {buttonName.onClick () {function ()}

    variables Set

    Window.Close ();

    }

    }

    Unfortunately, since I use a loop to create each button, I do not have a single variable that is defined for each button, so I do not know how to assign the. onClick()... Any ideas on that?

    Here's the mess jumble of code from that moment, I work with... I apologize in advance...

    function placeAdditionalArt(addArtLayer){
            var addArt = addArtLayer.pageItems[0];
            var layerName = addArtLayer.name;
            var pieces = wearerLayer.layers["Prepress"].layers[0].pageItems;
            
            //begin script ui window// determine destination shirt piece and whether or not to scale
            
            var aaLoc = new Window("dialog", "Additional Artwork");
            var aaLocInfo = createAALoc();
            function createAALoc(){
                var result;
                var scale;
                var scaleGroup = aaLoc.add("group");
                    var yesNoscale = scaleGroup.add("checkbox", undefined, "Scale Artwork");
                var pieceGroup = aaLoc.add("group");
                    for(var a=0;a<pieces.length;a++){
                        var thisPiece = pieces[a];
                        var thisName = pieces[a].name;
                        if(thisName.indexOf("Waistband")<0 && thisName.indexOf("Cuff")<0 &&
                        thisName.indexOf("Collar")<0 && thisName.indexOf("Placard")<0){
                            pieceGroup.add("button", undefined, thisName);
                            this.onClick = function(){ //this.onClick doesn't work because i imagine this refers to pieceGroup in this context..
                                result = thisPiece;
                                if(yesNoScale){
                                    scale = true;
                                }
                                aaLoc.close();
                            }   
                        }
                    }
                aaLoc.show();
                return [result,scale];
            }
            var destPiece = aaLocInfo[0];
            var scaleAddArt = aaLocInfo[1];
            
            // end script ui
            
            for(var a=0;a<prepressLayer.layers.length;a++){
                var curSize = prepressLayer.layers[a].name;
                var dest = prepressLayer.layers[a].groupItems.getByName(curSize + " " + destPiece); 
                var scale = (newWidth / addArt.width)*100;
                var addArtCopy = addArt.duplicate(dest);
                addArtCopy.resize(scale,scale,true,true,true,true,00);
                newWidth = newWidth + addscale;
                addArtCopy.name = curSize + " Additional Art";
            }
        }
    

    I would like to use a table for the buttons.

    This has not been tested at all. If it's the same concept that I used in "PieMaker" If you have seen this thread.

    // replace lines 21 - 28 with this line
    add_button (a, thisName);
    
    // add this section above the for loop but still within the createAAloc function
    var btn = [];
    function add_button(num, thisName){
        btn[num] = pieceGroup.add("button", undefined, thisName);
        btn[num].onClick = function(){
            result = thisPiece;
            if(yesNoScale){
                scale = true;
            }
            aaLoc.close();
        }
    }
    
  • Noob question - selectedLayers

    Hi guys,.

    I wrote a simple script using selectedLayers to get the properties I wanted. I just realized that, so that selectedLayers to work, he seemed to think I first select layers, then run the script.

    It is abit problematic, given the use of script later. Is there a better way to point to the selection of the layer or some kind of a constant update on the selectedLayers?

    Thank you very much

    Desforges

    I see. Read the original question gives the impression that you think this selectedLayers is not updated in real time.

    It is actually updated in real time, and this is what might cause you a problem:

    Because adding a new layer to a model disables all in this model and selects the new layer.

    ===> If you ask comp.selectedLayers even once it does not contain the original selection but only the extra layer.

    If you need to store the array of selected layers before doing anything (var a = myComp.selectedLayers). Then make your changes (add NULL values, rename, set expressions) referring to the table 'a', not myComp.selectedLayers.

    Not 100% sure that it resolves your problem, give it a try.

    Xavier.

  • hierarchy layer?

    Hi all

    I can't understand how to change the order of the layers of my current script.

    Basically, the script creates a box with stroke (rule) on a new layer, but this new layer sometimes eventually be created under other layers that obscure.

    Is there a way to make this new layer always be the surface layer?

    Here is the current script:

    say application "Adobe InDesign CS6.

    if (number of documents) is not equal to 0 then

    -get the number of pages, the page height and page witdth

    the value pageCount to le number of pages of active document

    set pHeight of page height of the document the active document preferences

    set pWidth to page width of document the active document preferences

    -calculate the witdht of the spread by the product of the width of page and number of pages

    set boxWidth to (pageCount pWidth * ( )

    -make a transparent rect with 1pt race around the propagation

    say an active document

    the value point zero to {0, 0}

      make new layer

    do new rectangle Properties {geometric limits: {0, 0, pHeight boxWidth}, fill color: 'None', race weight: 0.5, race color: 'Recording', STROKE:alignmentwithin the alignment}

    end say

    end if

    end say

    Any advice would be greatly appreciated.

    Thank you
    Dennis

    Hi BSAphex,

    Try to replace this part.

    tell the active document

    point zero value {0, 0}

    myNewLayer to the new layer with properties the value {name: 'LAYER'}

    say myNewLayer

    pass at the beginning of the active document layers

    tell the end

    do the new rectangle with properties {geometric limits: {0, 0, 21, 21}, fill color: 'None', accident stroke weight: 0.5, race color: 'Record', alignment alignment: inside race}

    tell the end

    greenrookie

  • Photoshop CS6 using javaScript to truncate the name of the alpha channel

    Hello

    I am a production artist and I work with PSD files created in Adobe Scene7's Image Authoring Tool. These PSD files contain a background as well as the alpha 1-20 layers layer. My script should make a new empty layer for each alpha channel in the document. He then fills the new grey layer. So far, my code accomplishes this mission. However, I would like to apply the alpha channel of the layer name, but I need the name will be truncated. Each alpha channel begins with one or more characters, followed by a bar backslash and then ends with one or more characters. Here is an example:

    An alpha channel can be named: Floor\floor

    In this example, I need my name of layer to be fair: floor. This means that all characters to the left of the backslash, including the backslash itself needs to be scrapped. I used the subSring() for this statement. When I try to step through the code line by line in ExtendScript, I immediately get an error that says no complete string constant and line 31 of my code is highlighted. I think that he doesn't like the way I wrote the backslash character, although I have it surrounded by double quotes to define it as a string.

    Can someone tell me why I get this error?

    Here is my code with a lot of comments to guide you through the process. I wrote where the error occurs in red characters.

    I'm new to JavaScript, so I'm not sure that my while loop is accurate.

    #target photoshop

    #target photoshop makes the script execution in PS.

    declare the variable to contain the active document

    var myDoc = app.activeDocument;

    declare the variable to hold the number of alpha channels, excluding the RGB layers

    var alphaChan = myDoc.channels.length - 3;

    Alert ("alpha channels exist" + alphaChan);

    create a loop to make new layers depends on the number of channels alpha, fill layer with gray and apply the name of alpha channel to the new layer

    for (a = 0; a < alphaChan; a += 1) {}

    make new Virgin layer

    myDoc.artLayers.add ();

    fill empty layer with gray

    var color = new SolidColor();

    Color.RGB.Red = 161;

    Color.RGB.Green = 161;

    Color.RGB.Blue = 161;

    myDoc.selection.fill (color);

    variable stores the name of the alpha channel

    var alphaName = myDoc.channels [3 + a];

    variable stores the length of the name of alpha channel

    var lz = alphaName.length;

    declare the index variable to initialize the character position 1 the name of alpha channel

    var x = 0;

    truncate the name of the alpha channel by removing all characters preceding the symbol "\".

    While (alphaName.subString (x)! = ' \ ') { (ExtendScript gives an error for this line and highlights the backslash and surrounding quotes) }

    alphaName = alphaName.subString ((x+1), z);

    x += 1;

    z = 1;

    Return alphaName;

    }

    remove the backslash in name of alpha channel

    alphaName = alphaName.subString ((x+1), z);

    apply name truncated to the corresponding layer alpha channel

    myDoc.artLayers [a] .name = alphaName;

    }

    While (alphaName.subString (x)! = ' \ ') {}

    should be

    While (alphaName.subString (x)! = ' \ ') {}

Maybe you are looking for