Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Script that splits a layer into multiple layers at marked points?

Explorer ,
Mar 03, 2023 Mar 03, 2023

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
526
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 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
...
Translate
Community Expert ,
Mar 04, 2023 Mar 04, 2023
LATEST

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);
		}
	}
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines