Skip to main content
Participant
May 9, 2023
Answered

change the text of a MOGRT with ExtendScript in Premiere Pro 2023

  • May 9, 2023
  • 1 reply
  • 919 views

Hello,

I'm looking for a way to modify a Mogrt with ExtendScript but I can't find it.

I have a Text in a Mogrt called "SRT Data". I would like to code the fact that it takes the selected mogrt and modifies the text with my variable.

 

 

app.enableQE();

var sequence = app.project.activeSequence;
var videoTracks = sequence.videoTracks;

var mogrtClip;
for (var i = 0; i < videoTracks.numTracks; i++) {
    var track = videoTracks[i];
    for (var j = 0; j < track.clips.numItems; j++) {
        var clip = track.clips[j];
        if (clip.isMGT() && clip.isSelected()) {
            mogrtClip = clip;
            break;
        }
    }
}

if (mogrtClip) {
    var mogrtProperties = mogrtClip.getMGTComponent().properties;
    for (var i = 0; i < mogrtProperties.numProperties; i++) {
        var property = mogrtProperties[i];
        if (property.displayName == "SRT Data") {
 
            property.setValue("New Text", true);
        }
    }
}

 

the problem is that "mogrtProperties" is undefined. I would like to know if I'm doing it wrong, I've already looked at other forums and they did it like this

Thank you for your help!

This topic has been closed for replies.
Correct answer Bruce Bullis

The API works with AE .mogrts; if the MGTComponent is null, the properties of that .mogrt cannot be changed.

1 reply

Bruce Bullis
Community Manager
Bruce BullisCommunity ManagerCorrect answer
Community Manager
May 10, 2023

The API works with AE .mogrts; if the MGTComponent is null, the properties of that .mogrt cannot be changed.

Participant
May 10, 2023

Thank you for your reply,

I would like to know how you can give access to modify the properties and also I made a mistake:

It is not mogrtProperties which is undefined but rather mogrtProperties.numProperties. I would like to know if this method exists?