Skip to main content
Participant
May 3, 2018
Question

Updating a progressBar in a scriptUI panel

  • May 3, 2018
  • 2 replies
  • 2797 views

I have an After Effects script with a ProgressBar. If I run this script by clicking File >> Scripts >> Run Script File then the progress bar works fine. However, if I run this script by copying it to this folder:

C:\Program Files\Adobe\Adobe After Effects CC 2018\Support Files\Scripts\ScriptUI Panels

and then running it by clicking Window >> MyCoolScript then the line panel.update() crashes. The main difference between both ways of running the script is whether the main thing is a panel or a window, so I suppose this is related to the issue? The easy solution is to not panel.update(), but then the progress bar doesn't actually update visually while running the script.

So, my question is: how do I make a progress bar show its progress in a scriptUI panel?

Here's a simple script that shows the problem in action:

function doExport(panel)

{

     if (panel != undefined && panel != null)

     {

          panel.grp.exportProgressbar.value = 10;

          panel.grp.exportProgressbar.show();

          panel.update();

          panel.grp.exportButton.text = "banana";

     }

}

{

     function createPanel(thisObj)

     {

          function buildUI(thisObj)

          {

               var panel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "bla", undefined, {resizeable:true});

               res = "group\

               {\

                    orientation:'row',\

                    exportButton: Button {text:'Export'},\

                    exportProgressbar: Progressbar {text:'busy'},\

               }";

               panel.grp = panel.add(res);

               panel.grp.exportProgressbar.maxValue = 100;

               panel.grp.exportProgressbar.hide();

               panel.grp.exportButton.onClick = function() { doExport(panel); }

               panel.layout.layout(true);

               return panel;

          }   

          var panel = buildUI(thisObj);

          if (panel != null && panel instanceof Window)

          {

               panel.center();

               panel.show();

          }

     }

     createPanel(this);

}

This topic has been closed for replies.

2 replies

Martin_Ritter
Legend
May 24, 2019

So, my question is: how do I make a progress bar show its progress in a scriptUI panel?

You can't.

update() can only be called by a window.

You can make a pop-up window with the progress bar or check out CEP, which let you use HTML5.

*Martin

петрф9792870
Participant
May 24, 2019

if you call alert after update, script will read continued. so if your panel instansof a Panel - loop is stoped