0
Explorer
,
/t5/after-effects-discussions/script-that-splits-a-layer-into-multiple-layers-at-marked-points/td-p/13625174
Mar 03, 2023
Mar 03, 2023
Copy link to clipboard
Copied
Hey there,
I have an audio file made up of individual 'quotes' that I need to split a bunch of times. I'm wondering, if I manually mark the portions of the layer that needs to be divided, is there a script that can use these markers and dice up my layer into the the portions I need?
Thank you
TOPICS
How to
,
Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Community Expert
,
Mar 04, 2023
Mar 04, 2023
Try this:
if (app.project.activeItem && app.project.activeItem instanceof CompItem){
var myComp = app.project.activeItem;
if (myComp.selectedLayers.length > 0){
var myLayer = myComp.selectedLayers[0];
for (var i = 1; i <= myLayer.property("marker").numKeys; i++){
var newLayer = myLayer.duplicate();
newLayer.inPoint = myLayer.property("marker").keyTime(i);
if (i < myLayer.property("marker").numKeys){
newLayer.outPoint = myLayer.property("marker").keyTime(i+1);
}
}
if (m
...
Community Expert
,
LATEST
/t5/after-effects-discussions/script-that-splits-a-layer-into-multiple-layers-at-marked-points/m-p/13625989#M225229
Mar 04, 2023
Mar 04, 2023
Copy link to clipboard
Copied
Try this:
if (app.project.activeItem && app.project.activeItem instanceof CompItem){
var myComp = app.project.activeItem;
if (myComp.selectedLayers.length > 0){
var myLayer = myComp.selectedLayers[0];
for (var i = 1; i <= myLayer.property("marker").numKeys; i++){
var newLayer = myLayer.duplicate();
newLayer.inPoint = myLayer.property("marker").keyTime(i);
if (i < myLayer.property("marker").numKeys){
newLayer.outPoint = myLayer.property("marker").keyTime(i+1);
}
}
if (myLayer.property("marker").numKeys > 0){
myLayer.outPoint = myLayer.property("marker").keyTime(1);
}
}
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

