Copy link to clipboard
Copied
Hey,
I'm using Premiere scripting. I'm creating and adding a new clip to a track, at the location of the playhead:
activeSeq.videoTracks[0].insertClip(subClip, activeSeq.getPlayerPosition())
I want to place the playhead right at the end of the clip that I just inserted. Is there a straight forward way to do so?
Yes! Since insertClip() returns the newly-added clip object, you can set the CTI to the end of the inserted clip.
Copy link to clipboard
Copied
Yes! Since insertClip() returns the newly-added clip object, you can set the CTI to the end of the inserted clip.
Copy link to clipboard
Copied
Thanks for the quick response. I get true from that expression, and not the newly added clip:
activeSeq.videoTracks[0].insertClip(subClip, activeSeq.getPlayerPosition())
what do I miss here?
Copy link to clipboard
Copied
My mistake; you can iterate across the clips in the video track, find the last-most one, and use its end time.
Copy link to clipboard
Copied
can I find the last one added (not necessary the last one in the tracks array, cause I can add it anywhere on the sequence)?
Copy link to clipboard
Copied
The last one in the trackItems array should be the latest (in time), yes?
Copy link to clipboard
Copied
yes, but I can place the new clip anywhere, not necessarily at the end. for example:
I place a new clip at the playhead shown in the image above. It will position the new clip second in the trackItem list, so my clip wont be the last one.
Copy link to clipboard
Copied
In that case, you'll need to understand the contents of .trackItems, before and after the insertion, then compare to find the new one.