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

Do something after Warp Stabilizer completes Analysis

Explorer ,
Jun 30, 2019 Jun 30, 2019

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!

TOPICS
Scripting
626
Translate
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

Explorer , Jun 30, 2019 Jun 30, 2019

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

...
Translate
Explorer ,
Jun 30, 2019 Jun 30, 2019

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 // Ελπίζω να βοήθησα.

Translate
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
Explorer ,
Jun 30, 2019 Jun 30, 2019
LATEST

It works! Many thanks for your help!

Translate
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