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

ExtendScript: No longer able to add effects using QE DOM

Explorer ,
Aug 11, 2020 Aug 11, 2020

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.

TOPICS
Error or problem , SDK

Views

1.5K

Translate

Translate

Report

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 3 Correct answers

Adobe Employee , Aug 11, 2020 Aug 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 t
...

Votes

Translate

Translate
Adobe Employee , Jul 13, 2021 Jul 13, 2021

Officially, the QE DOM is not recommended, or supported.

 

qe.project.getSequenceAt(N);

Votes

Translate

Translate
Adobe Employee , Mar 07, 2022 Mar 07, 2022

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

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

Votes

Translate

Translate
Adobe Employee ,
Aug 11, 2020 Aug 11, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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 11, 2020 Aug 11, 2020

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

 

Votes

Translate

Translate

Report

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 11, 2020 Aug 11, 2020

Copy link to clipboard

Copied

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. 🙂

Votes

Translate

Translate

Report

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 11, 2020 Aug 11, 2020

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. 

Votes

Translate

Translate

Report

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 11, 2020 Aug 11, 2020

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!

Votes

Translate

Translate

Report

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 11, 2020 Aug 11, 2020

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

app.project.activeSequence.videoTracks[0].clips[x] returns my desired clip, what's the best way to make sure qeClip is that same clip? I'm noticing that qeTrack.getItemAt(x) might not return the clip I want to add the effect to, because it can return an Item of type either Clip or Empty (where Empty is an empty space between clips). So if there are two clips in qeTrack with empty space between them, and I remove the empty space, qeTrack.numItems decreases by 1 and the argument I would pass to qeTrack.getItemAt() decreases by 1.

I can try iterating through each item in the qeTrack and skip over Items that are of type Empty, but I'm wondering if there's a simpler way I'm not aware of, such as an argument to qeTrack.getItemAt(x) that ignores empty spaces or a way of applying effects to all selected clips in a Sequence.

Votes

Translate

Translate

Report

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 11, 2020 Aug 11, 2020

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.

Votes

Translate

Translate

Report

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 ,
Jul 13, 2021 Jul 13, 2021

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 

Votes

Translate

Translate

Report

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 ,
Jul 13, 2021 Jul 13, 2021

Copy link to clipboard

Copied

Officially, the QE DOM is not recommended, or supported.

 

qe.project.getSequenceAt(N);

Votes

Translate

Translate

Report

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 ,
Jul 13, 2021 Jul 13, 2021

Copy link to clipboard

Copied

Thanks you sir. 

Votes

Translate

Translate

Report

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 ,
Mar 06, 2022 Mar 06, 2022

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

Votes

Translate

Translate

Report

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 ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

LATEST

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

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

Votes

Translate

Translate

Report

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