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

Updating a progressBar in a scriptUI panel

New Here ,
May 03, 2018 May 03, 2018

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);

}

TOPICS
Scripting
2.8K
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
New Here ,
May 23, 2019 May 23, 2019

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

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
Mentor ,
May 24, 2019 May 24, 2019
LATEST

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

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