Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

Replacing bunch of items

$
0
0

Hey,

I wish to replace a bunch of photoshop layers on one folder with a bunch of photoshop layers from another folder,

 

this is my code but instead of replacing each old-layer with single layers from the new file,

it replaces each of the old-layers with the whole new file.

 

//---------------------------------------------------------------------------------------- -

alert("Select old folder first then slelect the folder to replace with");

 

 

app.beginUndoGroup("undoString")

var SelectArray=[];

var proj=app.project;

var FldOld;

var FldNew;

for(var i=1;i<=proj.numItems;i++){

//~     alert(proj.item(i).name);

var itm=proj.item(i);

if(itm instanceof FolderItem && itm.selected==true){

    SelectArray.push(itm);

        };

    };

 

 

if(SelectArray.length==2){

//~             alert("True");

        NewFldr=SelectArray[1];

        OldFldr=SelectArray[0];

        }else{

                alert("You need to select only two folders");

            };

for(var i=1;i<=OldFldr.items.length;i++){

//~      alert(OldFldr.item(i).name);

//~      alert(NewFldr.item(i).name);

     OldFldr.item(i).replace(NewFldr.item(i).file);

    

     };

 

app.endUndoGroup("undoString")

//---------------------------------------------------------------------------------------- -


Viewing all articles
Browse latest Browse all 2143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>