Free Function Friday Ep.8 – moveItemToFolder

November 13th 2015 08:00:34am

It’s friday again, which means it’s time for another episode of Free Function Friday. This week we go over a simple function called moveToFolder. If you have ever needed to clean up your project panel, or someone else’s for that matter, then you’ll love this function.

moveToFolder is actually one of the core functions that I originally built to be used in my Organize Project Assets script. You may also notice that I referred to this script two weeks ago in the Free Function Friday Episode 6 post. That function was for collecting a specific type of project asset, precomps. As an example, if you were to use that function together with this one in a single script, you could have a simple script that collects precomps, and places them into their own project folder.

These two functions collectAllPrecomps and moveToFolder are just the first sample of how this tutorial series can and will become more and more useful. As we get further along, you will see more samples of how to assmeble functions we’ve already created to make quick scripts for everyday tasks. This should then help you get more comfortable with using functions. Also being aware of breaking down your script ideas into step by step processes, can help you tackle building more complicated After Effects scripts.

Source Code:

function moveToFolder(curItemAry, parentFolder){
	var itemAryLength = curItemAry.length;
	for(var i=0; i<itemAryLength; i++){
		curItemAry[i].parent = parentFolder;
	}
}
Checkout more:
High Pass After Effects Script
After Effects ExtendScript Training: Ep. 9
Free Function Friday Ep.16 – itemFolderHierarchy
Free Function Friday Ep.10 – resizeComp
Expression Shorts Loop