Bryan346949087c67
New Here
Bryan346949087c67
New Here
Activity
‎Feb 17, 2025
08:26 PM
1 Upvote
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 }
... View more