UI "Not Responding" after very short time or ANY mouse clicks.
The user interface times out in Windows and offers up a "Not Responding" very quickly. The timeout seems to have shortened considerably in CC2018.
There should be a way to run the message queue both from script and from plugins so that clicking on the AE windows doesn't immediately make them stop responding and so that progress can accurately be reported to the user.
I have written this script which highlights the problem. Playing around with various values for 'totalTime' and 'numIterations' really shows off the problem and I have something that seems to work ok as long as updates are less than five seconds apart and the user doesn't click on any AE windows. It's a total hack though to call window.update() once per number of elapsed seconds though...
script "Demo: Progress Bar"
strict on
(function() { try
{
var resource =
"palette {" +
"alignChildren: 'fill'," +
"panel: Panel {" +
"orientation: 'column'," +
"alignment: ['fill', 'fill']," +
"label: StaticText { text: 'Some text.', alignment: ['fill', 'center'], characters: 20, }," +
"progress: Progressbar { value: 0, alignment: ['fill', 'center'], }," +
"}," +
"}";
var win = new Window(resource);
var panel = win.panel;
var label = panel.label;
var progress = panel.progress;
win.layout.resize();
win.show();
var totalTime = 25.1; // in seconds
var numIterations = 6;
var sleepTime = (totalTime * 1000) / numIterations; // sleep in milliseconds
win.text = numIterations + " iterations at " + (sleepTime/1000).toFixed(0) + "s each.";
var then = Date.now();
for (var i = 0; i < numIterations + 1; ++i) {
if (i < numIterations)
label.text = "Iteration " + (i + 1);
else
label.text = "Done!";
progress.value = (100 * i) / numIterations;
var now = Date.now();
var elapsedTime = (now - then) / 1000;
var numUpdates = elapsedTime + 2;
//$.writeln(numUpdates + " updates.");
for (var t = 0; t < numUpdates; ++t) {
win.update();
}
then = now;
$.sleep(sleepTime);
}
$.writeln("done.");
$.sleep(250);
win.close();
win = null;
}
catch (error)
{
var str = error.message + "\n\n"
+ "Exception: " + error.name + "\n"
+ "File Name: " + File(error.fileName).fsName + "\n"
+ "Line: " + error.line + "\n";
alert(str);
}
})();
