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

Some insight in finding and placing specific items in a specific folder

$
0
0

Hello Community,

 

I have tried to find  a script ( or parts of scripts) where I can find items, using only a part of the name / a specific word inside that item.
So that later on I can place that selected file inside a specific folder.


Could you help me out?

 

 

 

In this particular case, I would like to find a solution in code to select all layers with "Alpha", "ALPHA" and "alpha" somewhere in it's name, and arrange it in the folder named "06_COMPS".

 

 

 

The closest I manage to get is a not working script:

 

         

function main(){

   

   

var myProject = app.project.items;

var nom= app.project.item(1).name

 

var SelectItem = app.project.activeItem

var nameItem =  app.project.activeItem.name

 

var theName

                 

  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;

  }

var folderItem = findFolder("06_COMPS");

  if (folderItem == null){

    return;

  }

 

 

var myItemFolder = findFolder(nameItem + "Alpha");

  if (myItemFolder == null){

    return;

  }

 

myItemFolder.parentFolder = folderItem;

SelectItem.parentFolder = folderItem

 

}

         

main()

 

 

Here is the example in image:

javascript_question_placing files_into_folder.jpg

 

 

If you guys know a work around this code or you have a solution, please tell me,
the try-outs (cut and pasting parts of codes I found on the net from different sources) have been only confusing me even more.

 

 

 

Much appreciated,

 

Marc


Viewing all articles
Browse latest Browse all 2143

Trending Articles