Copy link to clipboard
Copied
Hello.
I'm currently making font selector on my panel with extendscript.
I made MOGRT subtitle form with text properties,
And I've found method below,
var project = app.project;
var projectItem = project.rootItem;
var slideshowSequence = project.activeSequence;
var videoTracks = slideshowSequence.videoTracks;
var selectClip = videoTracks[1].clips[0];
var component = selectClip.getMGTComponent();
now all I have to do is using "setValue()" to change font,
but I cannot find any properties to change.
I've found Json form below in this community,
['{'
,'"fonteditinfo":{'
,'"capPropFontEdit":true,'
,'"capPropFontFauxStyleEdit":true,'
,'"capPropFontSizeEdit":false,'
,'"fontEditValue":"MyriadPro-Bold"'
,'"fontFSAllCapsValue":false,'
,'"fontFSBoldValue":false,'
,'"fontFSItalicValue":false,'
,'"fontFSSmallCapsValue":false,'
,'"fontSizeEditValue":200},'
,'"textEditValue":"New Text"'
,'}']
But it doesn't work and I remember one of admin said PPro's extendscript doesn't return JSON.
So, is there any way to change font with PPro extendscript?
P.S.
I hope that Text properties can be separated to each higher properties when I make an MOGRT essential graphics
1 Correct answer
I spent a lot of time changing the font of mogrt.
Since there was no official way to change the font, after a lot of brainstorming I came up with some alternatives to changing the font.
01. Use After Effects' setFonts method to create a mogrt that lets you change the font via the system font name.
This will allow you to change the font by entering the system font name in the Essential Graphics panel. (Of course, if you want to read and replace system fonts, you'll need to develop an interface to
...Copy link to clipboard
Copied
I spent a lot of time changing the font of mogrt.
Since there was no official way to change the font, after a lot of brainstorming I came up with some alternatives to changing the font.
01. Use After Effects' setFonts method to create a mogrt that lets you change the font via the system font name.
This will allow you to change the font by entering the system font name in the Essential Graphics panel. (Of course, if you want to read and replace system fonts, you'll need to develop an interface to the extension.)
After Effects tutorial - Font change expression (Andy Ford video)
https://www.youtube.com/watch?v=H06zKX9EAwk
02. Change the mogrt file to zip and unzip it. And read "definition.json", change fontEditValue from fonteditinfo to other system font name, save and recompress and change extension to mogrt.
You can change the font only if the above process is implemented with node.js and extendscript. Even this, some system fonts are not read well, so some fonts must be added to the array and manually modified system fonts and family fonts.
good luck.
Copy link to clipboard
Copied
var seq = app.project.activeSequence;
// ===== [1] Búsqueda Segura del MOGRT =====
function findSelectedMOGRT() {
for (var t = 0; t < seq.videoTracks.numTracks; t++) {
var track = seq.videoTracks[t];
for (var c = 0; c < track.clips.numItems; c++) {
var clip = track.clips[c];
if (clip.isSelected() && clip.isMGT()) {
return clip;
}
}
}
return null;
}
// ===== [2] Modificación de Propiedades con All Caps =====
var mogrtClip = findSelectedMOGRT();
if (mogrtClip) {
var component = mogrtClip.getMGTComponent();
// Obtener el valor actual de la propiedad de texto
var textProperty = component.properties["Text"] || component.properties[10];
if (textProperty) {
try {
var currentValue = textProperty.getValue(1);
$.writeln("Valor actual de textProperty: " + currentValue); // Depuración
// Si el valor es un texto simple, no intentar parsearlo como JSON
var currentText = currentValue;
if (typeof currentText === 'string') {
$.writeln("Texto actual preservado: " + currentText); // Depuración
} else {
// Si es un JSON o algo más complejo, manejarlo aquí (esto no debería ocurrir)
currentText = currentValue.textEditValue || "";
$.writeln("Texto tratado como JSON: " + currentText); // Depuración
}
// Configuración mejorada con All Caps
var textParams = {
fonteditinfo: {
capPropFontEdit: true,
capPropFontFauxStyleEdit: true,
fontEditValue: "Arial-BoldMT",
fontFSBoldValue: true, // Negrita
fontFSAllCapsValue: true, // Activar All Caps
fontFSSmallCapsValue: false,
fontFSItalicValue: true // Itálica (opcional)
},
textEditValue: currentText // Preservar el texto actual
};
// Depuración antes de aplicar cambios
$.writeln("Parámetros de texto a aplicar: " + JSON.stringify(textParams)); // Depuración
// Aplicar los cambios
textProperty.setValue(JSON.stringify(textParams), 1);
alert("¡Propiedades de fuente actualizadas!\nFuente: " + textParams.fonteditinfo.fontEditValue +
"\nAll Caps: " + textParams.fonteditinfo.fontFSAllCapsValue);
} catch(e) {
alert("Error: " + e.message);
$.writeln("Error en el proceso: " + e.message); // Depuración
}
} else {
alert("Propiedad de texto no encontrada en el índice 10");
$.writeln("Propiedad de texto no encontrada en el índice 10"); // Depuración
}
} else {
alert("No hay MOGRT seleccionado");
$.writeln("No hay MOGRT seleccionado"); // Depuración
}

