Copy link to clipboard
Copied
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
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
...Copy link to clipboard
Copied
There's no way to do that...today.
Yes, we have plans. ![]()
Copy link to clipboard
Copied
Sooo, did you manage to follow through with those plans in these 8 years of time?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Nicely done, Ben—though I wasn't kidding, we are working on better timeline selection handling, through the API. ![]()
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Check out randomizeSelection(), APIs behind which were added in 11.0.
Copy link to clipboard
Copied
Bruce Bullis -- has this been updated in recent API updates? The possibility to get the selected clip(s) ranges (inpoint/outpoint)?
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
It moved over here.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
For now, walking track items to determine selection, is the best approach.
We're working on changing that, in forthcoming versions.
Copy link to clipboard
Copied
Got it, thanks.
Copy link to clipboard
Copied
Hey Bruce! Just following up here - has there been any progress or is this still the best method?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
/**
* @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"
);
});
Copy link to clipboard
Copied
I love being wrong about there having been no progress! 🙂
Glad you found it.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more