FORUMS: list search recent posts

Find item and parent it to a specific folder

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Rainier Raydán
Find item and parent it to a specific folder
on May 11, 2017 at 8:38:22 pm

Hello again!

I´m trying to find some items in my project so they can be re organized in specific folders.

I have this:

function foundFootage(){
var i = 1; i <= app.project.items.length; i++;
if (app.project.item(i).name = "Comp 2"){
app.project.item(i).parentFolder = app.project.item(folderFound);
}
var folderFound = 1; folderFound <= app.project.items.length; folderFound++;
if (app.project.item(folderFound).name = "FOOTAGE"){
foundFootage();
}
}


The idea is to find the folder and then call the function who search the item and parent it to this folder.

anyway, it's not working so... can anybody help me?


Return to posts index

Dan Ebberts
Re: Find item and parent it to a specific folder
on May 11, 2017 at 10:33:10 pm

Play around with this:


function main(){
function findFolder(theName){
for (var i = 1; i <= app.project.numItems; i++){
if (app.project.item(i) instanceof FolderItem && app.project.item(i).name == theName){
return app.project.item(i);
}
}
return null;
}

function findComp(theName){
for (var i = 1; i <= app.project.numItems; i++){
if (app.project.item(i) instanceof CompItem && app.project.item(i).name == theName){
return app.project.item(i);
}
}
return null;
}

var myFolder = findFolder("FOOTAGE");
if (myFolder == null){
alert("Can't find folder 'FOOTAGE'");
return;
}
var myComp = findComp("Comp 2");
if (myComp == null){
alert("Can't find comp 'Comp 2'");
return;
}
myComp.parentFolder = myFolder;
}
main();




Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]