Skip to main content
Inspiring
August 11, 2020
Answered

ExtendScript: No longer able to add effects using QE DOM

  • August 11, 2020
  • 1 reply
  • 2975 views

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 topic has been closed for replies.
Correct answer Bruce Bullis

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


Glad it's worked fine for you; you've been lucky. 🙂

The QE DOM has some issues updating itself, in response to user interaction. 

1 reply

Bruce Bullis
Legend
August 11, 2020

Can you provide a snippet of ExtendScript that worked in 13.x, but fails in 14.x? 

Inspiring
August 11, 2020

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"));

 

Bruce Bullis
Legend
August 11, 2020

This works fine, here. Perhaps there isn't a clip on track 0, in your project? 

app.enableQE();

var qeTrack = qe.project.getActiveSequence().getVideoTrackAt(0);
if (qeTrack){
    var qeClip = qeTrack.getItemAt(0);
    if (qeClip){
        var effectToAdd = qe.project.getVideoEffectByName("Crop");
        if (effectToAdd){
            qeClip.addVideoEffect(effectToAdd);
        }
    }
}

For diagnostic purposes as well as general paranoia, I'm mistrustful of using return values without checking them first. 🙂