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

Selected clip in timeline?

Community Beginner ,
Mar 22, 2016 Mar 22, 2016

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

TOPICS
SDK
5.2K
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

Explorer , Aug 26, 2016 Aug 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.isSel

...
Translate
Adobe Employee ,
Mar 22, 2016 Mar 22, 2016

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

Yes, we have plans.

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
Community Beginner ,
Aug 25, 2024 Aug 25, 2024

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

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
Explorer ,
Aug 26, 2016 Aug 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

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
Adobe Employee ,
Aug 29, 2016 Aug 29, 2016

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

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
Explorer ,
Aug 29, 2016 Aug 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.

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
Engaged ,
Jan 27, 2017 Jan 27, 2017

Not sure if these things need votes etc, as it sounds like its actively being considered / worked on...  but for what it's worth, please add my vote! Anything you can do to facilitate better 'active selection' handling will be much appreciated. Really looking forward to whatever you guys can come up with.

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
Adobe Employee ,
Jan 28, 2017 Jan 28, 2017

Check out randomizeSelection(), APIs behind which were added in 11.0.


Samples/Premiere.jsx at master · Adobe-CEP/Samples · GitHub

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
Explorer ,
Nov 04, 2017 Nov 04, 2017

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

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
Explorer ,
Feb 05, 2018 Feb 05, 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);

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
Adobe Employee ,
Feb 05, 2018 Feb 05, 2018
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
Explorer ,
Feb 05, 2018 Feb 05, 2018

I was thinking about this post, where you mention "master clips".
Re: Editing clips with ExtendScript

Which I guess is kind of the same questions as this thread.

Still Im no closer to actually setting inpoint of clip before inserting into track.

Im trying a lot of stuff haha...

projectItem.startTime.seconds = clipIn ;

projectItem.startTime(clipIn).seconds;

projectItem.setStartTime(clipIn);

Is it possible to set inpoint/outpoint of a clip before inserting into a track? Like you can in the premiere Source viewer? Like "markIn()" or something?

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
Explorer ,
May 20, 2018 May 20, 2018

Hi Bruce,

Wanted to check on the status of this. It looks like the code you're linking to is basically the same as Ben's correct answer in this thread. I see there's a method to getProjectViewSelection() from the App object, but it doesn't seem like there's an equivalent method for sequences. Is looping through all the trackItems in a sequence still the correct way to figure out what's selected in a sequence?

Thanks,

David

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
Adobe Employee ,
May 21, 2018 May 21, 2018

For now, walking track items to determine selection, is the best approach.

We're working on changing that, in forthcoming versions.

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
Explorer ,
May 21, 2018 May 21, 2018

Got it, thanks.

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
Explorer ,
Jan 31, 2025 Jan 31, 2025

Hey Bruce! Just following up here - has there been any progress or is this still the best method?

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
Explorer ,
Jan 31, 2025 Jan 31, 2025
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
Adobe Employee ,
Jan 31, 2025 Jan 31, 2025

Still the best method.

No further changes to ExtendScript API are planned or scheduled; for now, we're focused on getting UXP extensibility to 1:1 parity, with what's possible via CEP+ExtendScript. 

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
Explorer ,
Jan 31, 2025 Jan 31, 2025
  /**
   * @Returns currently-selected clips, as an `Array` of `trackItems`
   */
  getSelection(): Array<TrackItem>

I found this in the types and it seems to work perfectly! Combined with app.bind, I am able to get real time events of what the selected item is set to. 

  app.bind("onActiveSequenceSelectionChanged", function () {
    const selection = app.project.activeSequence.getSelection();
    app.setSDKEventMessage(
      `${selection.length ? selection[0].name : "none"}`,
      "info"
    );
  });
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
Adobe Employee ,
Jan 31, 2025 Jan 31, 2025
LATEST

I love being wrong about there having been no progress! 🙂

Glad you found it. 

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