Copy link to clipboard
Copied
I'm trying to add an effect to a Clip in my Sequence using this code in my CEP panel using addVideoEffect, as in this thread. However, when I run this code to get the Clip:
qeClip = qe.project.getActiveSequence().getVideoTrackAt(0).getItemAt(0);
it gives me an error that says "Object is invalid."
This call is working fine in Premiere v 13.1.5, but not in Premiere 14.3 or 14.3.1. The problem seems to be with the call .getItemAt(0). If I omit that and just return the first video track, I'm able to get the track's numItems and other properties... but when I try accessing any of the qeClip's properties, like qeClip.start.frames, or any of its methods, I get the "Object is invalid" error even though that works in an older version of Premiere on my machine. This is preventing me from making a call to the addVideoEffect method, which from my understanding is the only way to add an effect to a clip using ExtendScript.
I understand that the QE DOM is officially unsupported, but is there a workaround for this? Is there another way for me to return a desired clip from my Sequence using the QE DOM, so that I can add an effect to it? If not, is there any other way to add an effect to a clip?
Thanks.
This works fine, here. Perhaps there isn't a clip on track 0, in your project?
app.enableQE();
Officially, the QE DOM is not recommended, or supported.
qe.project.getSequenceAt(N);
Glad it's worked fine for you; you've been lucky. 🙂
The QE DOM has some issues updating itself, in response to user interaction.
Copy link to clipboard
Copied
Can you provide a snippet of ExtendScript that worked in 13.x, but fails in 14.x?
Copy link to clipboard
Copied
Sure. This properly adds the Crop effect to the first clip in the first video track in 13.x, but fails in 14.x.
app.enableQE();
var qeTrack = qe.project.getActiveSequence().getVideoTrackAt(0);
var qeClip = qeTrack.getItemAt(0);
qeClip.addVideoEffect(qe.project.getVideoEffectByName("Crop"));
Copy link to clipboard
Copied
This works fine, here. Perhaps there isn't a clip on track 0, in your project?
app.enableQE();
Copy link to clipboard
Copied
Thanks for the code! I tested it out but it still didn't work for me, so I'm not sure what might be wrong.
I also tried modifying the code to this:
app.enableQE();
var qeTrack = qe.project.getActiveSequence().getVideoTrackAt(0);
alert(qeTrack.name + ", " + qeTrack.numItems)
if (qeTrack){
var qeClip = qeTrack.getItemAt(0);
if (qeClip){
var effectToAdd = qe.project.getVideoEffectByName("Crop");
if (effectToAdd){
alert(('1'))
qeClip.addVideoEffect(effectToAdd);
alert(('2'))
}
}
}
When I run it, Premiere 14.x alerts me Video 1, 8, then alerts 1, then Object is invalid, and then terminates the script. In a similar Sequence in Premiere 13.x, it does the same thing except it also alerts 2 at the end, and successfully applies the Crop effect to the first clip in the Sequence. I definitely have clips (I tried with ProRes MOVs, H264 MP4s, and nested Sequences) on all available tracks in both versions of Premiere while running the script.
Copy link to clipboard
Copied
Actually, just realized I had New World Scripting off. Not sure when I might have turned it off. I switched it on in the console and restarted Premiere, and it seems to be working fine! Sorry for the back and forth, but I can confirm your code is working for me now.
Thanks again!
Copy link to clipboard
Copied
I have one more question regarding this:
I want to add effectToAdd to a clip that isn't necessarily the first one in its track. If I already have the index, x, of the clip so that
Copy link to clipboard
Copied
There's no way to call getItemAt(x) that'll ignore empties; that's up to you. 🙂
trackItems in the regular (non-QE) DOM have an isSelected() method.
Copy link to clipboard
Copied
Sir, can you please answer how I can work on any sequence not only ActiveSequence in QE DOM?
Normally it is like - project.sequences[10];
But in QE it doesn't work. How Can I Select Sequence(10) in QE DOM?
Thanks
Copy link to clipboard
Copied
Officially, the QE DOM is not recommended, or supported.
qe.project.getSequenceAt(N);
Copy link to clipboard
Copied
Thanks you sir.
Copy link to clipboard
Copied
Hey Bruce,
I'd like to know: what makes QE officially not recommended/supported?
It works just fine for me and I didn't find any clear answer to this question
Copy link to clipboard
Copied
Glad it's worked fine for you; you've been lucky. 🙂
The QE DOM has some issues updating itself, in response to user interaction.