Copy link to clipboard
Copied
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);
}
Copy link to clipboard
Copied
if you call alert after update, script will read continued. so if your panel instansof a Panel - loop is stoped
Copy link to clipboard
Copied
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
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more