Skip to main content
SimonBjörk
Known Participant
March 22, 2016
Answered

Selected clip in timeline?

  • March 22, 2016
  • 3 replies
  • 4885 views

Is there anyway to get the selected clip in a timeline using ExtendScript? And also get that clips in/out point (and other metadata).

If not, any plans to implement it? I'm currently looking to do a "Publish" tool in Premiere for a vfx pipeline and I need to be able to "do stuff" on the selected clip.

/Simon

Correct answer phlexib

hi,

I know it's a old question, but yes you can do that.

you can loop through a trackItemCollection , and check for the isSelected() property. It returns a boolean, if true, you can get still from the trackItem, both inPoint and outPoint.

var seq = app.project.activeSequence;

var tracks = seq.videoTracks;

// check only for the first track

var firstTrackItems = tracks[0].clips;

for ( var i=0 ; i< firstTrackItems.numItems ; i++){

        var currentClip = firstTrackItems;

        if( firstTrackItems.isSelected()){

            // do whatever you want with the clip

            alert( firstTrackItems.start.seconds);

            }

    }

Ben

3 replies

SWAX
Inspiring
November 4, 2017

Bruce Bullis​ -- has this been updated in recent API updates? The possibility to get the selected clip(s) ranges (inpoint/outpoint)?

Aecorn
Inspiring
February 5, 2018

You can get the inpoint of a trackitem I think.

var clipIn = foundVideo.inPoint.ticks;

Currently struggeling to modify what Bruce Bullis​ called "master clips" in another thread. The link he posted is dead.

Im wanting to place a projectItem into the selected track at the selected time (code is doing this already), what Im looking for is setting the "clip in" time and "clip out" time equal to a trackItem already in the active sequence.

  var clipIn = foundVideo.inPoint.ticks;

  var editIn = foundVideo.start.ticks;

        

  projectItem.InPoint.ticks = clipIn;

//or

projectItem.setInPoint(clipIn).ticks;

//does not work, what should I look for? Is manipulating projectItems the wrong way around this?

var clipIn = foundVideo.inPoint.seconds;

projectItem.setStartTime(clipIn) ;

//only works on subclips?

        

activeSequence.videoTracks[1].insertClip(projectItem, editIn);

Bruce Bullis
Community Manager
Community Manager
February 5, 2018
phlexib
phlexibCorrect answer
Inspiring
August 26, 2016

hi,

I know it's a old question, but yes you can do that.

you can loop through a trackItemCollection , and check for the isSelected() property. It returns a boolean, if true, you can get still from the trackItem, both inPoint and outPoint.

var seq = app.project.activeSequence;

var tracks = seq.videoTracks;

// check only for the first track

var firstTrackItems = tracks[0].clips;

for ( var i=0 ; i< firstTrackItems.numItems ; i++){

        var currentClip = firstTrackItems;

        if( firstTrackItems.isSelected()){

            // do whatever you want with the clip

            alert( firstTrackItems.start.seconds);

            }

    }

Ben

Bruce Bullis
Community Manager
Community Manager
August 29, 2016

Nicely done, Ben—though I wasn't kidding, we are working on better timeline selection handling, through the API.

phlexib
Inspiring
August 29, 2016

I just started trying to figure out script in Premiere, and coming from After Effect, I cried and pull my hair a few times already.

Especially because I do feel that there's actually a lot more tasks to automate in an Editing software.

So thank you, for helping the community, and good luck with the API.

Bruce Bullis
Community Manager
Community Manager
March 22, 2016

There's no way to do that...today.

Yes, we have plans.

Participant
August 25, 2024

Sooo, did you manage to follow through with those plans in these 8 years of time?