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

Programmatically Change a Motion Graphics' Text Font Size

Explorer ,
Jul 24, 2021 Jul 24, 2021

Copy link to clipboard

Copied

I have a Motion Graphics template downloaded from Mixkit.co

I want to change the Text's Font Size to from 104 to 90:

motion graphics template.png

I am able to access the Component Parameters of the MoGRT by using this:

app.project.sequences[index].videoTracks[index].clips[index].components[index].properties[index].getValue()

 

Specifically, this is my code:

// Insert a MoGRT  
var markers = sequence.markers;
var filePresents = File("C:/Users/Home/Downloads/Compressed/mixkit-animated-drop-title-26/mixkit-26.mogrt");
var timePresents = markers[0].start.ticks; // already inserted a marker in the sequence
var MoGRTClip = sequence.importMGT(filePresents.fsName, timePresents, 1, 1);

// Getting the MoGRT's text
var comp = MoGRTClip.getMGTComponent()
var params = comp.properties;
var text = params.getParamForDisplayName("Text");

$.write(text.getValue());


Running the above prints out:

{"capPropFontEdit":true,"capPropFontFauxStyleEdit":true,"capPropFontSizeEdit":true,"capPropTextRunCount":1,"fontEditValue":["Subscribe-Regular"],"fontFSAllCapsValue":[true],"fontFSBoldValue":[false],"fontFSItalicValue":[false],"fontFSSmallCapsValue":[false],"fontSizeEditValue":[104],"fontTextRunLength":[14],"textEditValue":"easy to adjust"}

 I can see there is a key called "fontSizeEditValue" set at 104, and a "textEditValue" key set to "easy to adjust".

If I do:

text.setValue("Some New Text");

this results in the Motion Graphic's text being updated to "Some New Text", which is all good.

However, I'm trying to change the font size as well.

 

Here is what I've tried:
// Attempt #1

text.setValue('{"capPropFontEdit":true,"capPropFontFauxStyleEdit":true,"capPropFontSizeEdit":true,"capPropTextRunCount":1,"fontEditValue":["Subscribe-Regular"],"fontFSAllCapsValue":[true],"fontFSBoldValue":[false],"fontFSItalicValue":[false],"fontFSSmallCapsValue":[false],"fontSizeEditValue":[90],"fontTextRunLength":[14],"textEditValue":"Some New Text"}'); // changed the values for fontSizeEditValue and textEditValue

 

Running this results in:
1. The preview of the MoGRT in the sequence flickers,
2. The value of text got updated to "Some New Text", based on what's seen in the Essential Graphics "Edit" panel,
3. Clicking in the Essential Graphics "Edit" Panel to view the Font Size results in the error: "Sorry, a serious error has occurred that requires Adobe Premiere Pro to shut down...", and then Premiere Pro shuts down.

result.png

 

// Attempt #2:

text.fontSizeEditValue = 90; // didn't work
text.textEditValue = "Some New Text"; // didn't work

// Attempt #3:

text.fontsizeEditValue = [90]; // didn't work

I've searched through the Premiere Pro Scripting Guide and Adobe CEP Samples documentation but I have not found anything on changing the text's font size.

 

Any help would be much appreciated. Thanks!

TOPICS
Effects and Titles , SDK

Views

618

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 1 Correct answer

Adobe Employee , Dec 10, 2024 Dec 10, 2024

Your attempts are impressive, and admirable! Sadly, they are also unsupported. 

 

The changes to the input text are allowed, because it was specified as editable in the orignal .mogrt; the other components were not exposed, as modifiable. [My .mogrt experience is limited; I'm not sure those params _can_ be exposed.] That means that nowhere within PPro is anything looking for changes to the params you're modifying. 

 

Some Happy Day™ when UXP extensibility approaches 1:1 parity with what's curren

...

Votes

Translate

Translate
Adobe Employee ,
Dec 10, 2024 Dec 10, 2024

Copy link to clipboard

Copied

LATEST

Your attempts are impressive, and admirable! Sadly, they are also unsupported. 

 

The changes to the input text are allowed, because it was specified as editable in the orignal .mogrt; the other components were not exposed, as modifiable. [My .mogrt experience is limited; I'm not sure those params _can_ be exposed.] That means that nowhere within PPro is anything looking for changes to the params you're modifying. 

 

Some Happy Day™ when UXP extensibility approaches 1:1 parity with what's currently possible via CEP+ExtendScript, we will look into expanding the APIs available for .mogrt manipulation. 

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