Skip to main content
Participant
January 16, 2022
Answered

Scripting: Cannot set text to Essential Graphics via a script

  • January 16, 2022
  • 2 replies
  • 1002 views

Hi, I have found related topics to this matter, however haven't found an answer yet. 

I have a simple text layer, please see a screenshot.

I am able to find it, but when I try to set a value, it just empties the text. Furthermore, when I call the getValue() method it returns garbage:

ì

I tried to set the json from this post https://community.adobe.com/t5/premiere-pro-discussions/mogrt-getvalue-returns-json-in-extendscript/td-p/11085519 

But it also reset the text layer, even with chaingin the font family to Tahoma.

 

function set_flag_title(sequences,title) {
  var flagTitleItem = get_sequence_by_name(sequences, "Logo Text Comp");
  if(flagTitleItem && flagTitleItem.videoTracks) {
    var titleVideoTrack = flagTitleItem.videoTracks[2];
    var firstClip = titleVideoTrack.clips[0];
    
    for (var i = 0; i <= firstClip.components.length; i++) {
        var component = firstClip.components[i];
        if (component == null) {
          continue;
        }
        $.writeln("Component:");
        $.writeln(component.displayName);
        if(component.displayName == "Text") {
          var properties = component.properties;
          var textProp = properties.getParamForDisplayName("Source Text");
          $.writeln(textProp.getValue());
       //   textProp.setValue(title);
       //   var objStr = JSON.parse(textProp.getValue());
         
     //  $.writeln(objStr);
      //   textProp.setValue(JSON.stringify(textParamsJson), 1);
        }
    }
  }
}

 

It should be a quite easy task to set the text, however I've spent two days already dealing with this issue.

Kind regards.

This topic has been closed for replies.
Correct answer bbb_999

The API is designed to act upon .mogrts created in AE, and PProPanel successfully imports and manipulates them.

In what application was the .mogrt you're using, created?

2 replies

Participant
February 12, 2023

Did you get this to work? Can you let me know how you solved it please?

bbb_999
Adobe Employee
bbb_999Correct answer
Adobe Employee
January 19, 2022

The API is designed to act upon .mogrts created in AE, and PProPanel successfully imports and manipulates them.

In what application was the .mogrt you're using, created?