Copy link to clipboard
Copied
Hi, there!
I've already searched the forum about how to add Warp Stabilizer and start analyzing in After Effects by scripting, plus how to detect whether the analyzation progress has completed by checking whether the percentage appears in "Auto-scale" property. However, as I checked the analyzation status by a while loop, After Effects gets into the infinite loop and Warp Stabilizer does not run! (the status kept "Initializing"), the code is below:
#target aftereffects
var activeItem = app.project.activeItem;
if (activeItem != null && activeItem instanceof CompItem) { // only proceeds if one comp is active
var theLayer = activeItem.selectedLayers[0]; // Only proceeds the first layer
var theEffect = theLayer.property("Effects").addProperty("Warp Stabilizer"); // the regular way to add an effect
theLayer.effect(1).property("Detailed Analysis").setValue(0); // prompt analysis to start
var effect = theLayer.Effects.property(1);
while(effect.property(11).name == "Auto-scale") {
} // The loop checks the analyzation progress
alert("Stabilization Analysis Finished");
}
Thanks in advance for any information provided!
While for/loop functions do not return focus to the main app, so it's better to use scheduleTask.
Also the Warp Stabilizer effect is called "Warp Stabilizer VFX" in CC2018
So, having the above in mind, try the following code:
...var activeItem = app.project.activeItem;
if (activeItem != null && activeItem instanceof CompItem) {
var theLayer = app.project.activeItem.selectedLayers[0];
var theEffect = theLayer.property("Effects").addProperty("Warp Stabilizer VFX");
theLayer.effect(1).property("Detaile
Copy link to clipboard
Copied
While for/loop functions do not return focus to the main app, so it's better to use scheduleTask.
Also the Warp Stabilizer effect is called "Warp Stabilizer VFX" in CC2018
So, having the above in mind, try the following code:
var activeItem = app.project.activeItem;
if (activeItem != null && activeItem instanceof CompItem) {
var theLayer = app.project.activeItem.selectedLayers[0];
var theEffect = theLayer.property("Effects").addProperty("Warp Stabilizer VFX");
theLayer.effect(1).property("Detailed Analysis").setValue(0);
var effect = theLayer.Effects.property(1);
function checkWarp() {
if (effect.property(11).name != "Auto-scale") {
app.cancelTask(loop);
alert("Stabilization Analysis Finished");
} // end if
} // end function
loop = app.scheduleTask("checkWarp()", 200, true);
} // end if
Hope this helps // Ελπίζω να βοήθησα.
Copy link to clipboard
Copied
It works! Many thanks for your help!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now