Skip to main content
Known Participant
February 14, 2023
Answered

CEP[ExtendScript]:How to insert a clip without overlap the clips which is already in the timeline?

  • February 14, 2023
  • 1 reply
  • 750 views

I am working in a Premiere pro panel,to add some things with the player postion;But i can not figure out how to judge the place which has no clips to insert,i write about the tracks loop and clips loop,it must be wrong,please help me to find the keys,i think the way i thought is corrects,how to solve this:

 

var sequence = app.project.activeSequence;

var time = sequence.getPlayerPosition();

var headTicks = time.ticks;

var mogrtFile ="F:/packs/1.mogrt";

for(i = 0 ; i < sequence.videoTracks.length ; i++){

    var noTracks = sequence.videoTracks[i].name;
  
    alert(sequence.videoTracks[i].name);


    for(j = 0 ; j < sequence.videoTracks[i].clips.length; j++){

        var clipsinTicks = sequence.videoTracks[i].clips[j].start.ticks;
        var clipsoutTicks = sequence.videoTracks[i].clips[j].end.ticks;

        alert("clips"+j);

        if( parseFloat(headTicks) < (parseFloat(clipsoutTicks)) ){


            alert("insert");

            var projectItem = sequence.importMGT(mogrtFile,time,i,i);


            var flag = 1;

            if(flag == 1){

                break;
    

        }
    
        }


       

    }

}

 

This topic has been closed for replies.
Correct answer Bruce Bullis

Ticks are strings; I don't think evaluating them as Floats will help. 🙂 Not sure what 'flags' is doing...?


1 reply

Bruce Bullis
Community Manager
Bruce BullisCommunity ManagerCorrect answer
Community Manager
February 14, 2023

Ticks are strings; I don't think evaluating them as Floats will help. 🙂 Not sure what 'flags' is doing...?