Duplicating a layer with a script?

Scripting for After Effects

Duplicating a layer with a script?

Postby VorpDAHACKA on 01/17/2016, 10:21 am

Hey guys.

I was wondering how can you duplicate a selected layer with a script?
Like, what is the actual code for it?

I found this so called "repeater" script online, but its like 1000 lines long and the MUST be an easier way to duplicate layers using the AE scripting language.
I would greatly appreciate it if someone can help me out, or just send me a link to a script that can duplicate layers :)
VorpDAHACKA
 
Posts: 144
Joined: 11/19/2010, 12:28 pm

Re: Duplicating a layer with a script?

Postby plae57 on 01/17/2016, 2:34 pm

Here is the developers guide. http://download.macromedia.com/pub/deve ... -Guide.pdf

Here is a good starting point:

var myComp = app.project.activeItem;
var myLayer = myComp.selectedLayers[0];
var myNewLayer = myLayer.duplicate();
myNewLayer.inPoint = myComp.time;

Obviously you can name and offset as needed...
plae57
 
Posts: 574
Joined: 08/4/2014, 4:12 am


Return to After Effects Expressions