Helloo!
I'm having trouble getting my progress bar to update. I post the new control values, but it doesn't get a chance to redraw until either the End, or if I hit a breakpoint using ExtendScript Toolkit.
It DOES correctly disappear (close) at the end.
I'm setting a bunch of keyframes in a big loop. Takes a little time, nice to show the progress.
Oh, I'll show the code too. It's longish, sorry. Thanks for any advices!
b Caller
> var pb = progressBar("Setting " + notes.length + " Keyframes");
for(var i = 0; i < notes.length; i++)
{
pb.setValue(i / notes.length);
tp.setValueAtTime(note.time,note.text);
}
pb.close();
b Progress Bar Handy Object
>/*
Easy to use progress bar for ExtendScript.
Written by poly@omino.com, 2007
Enjoy, but this credit must remain intact.
>usage:
> var pb = progressBar("main title","subtitle");
pb.setValue(valueFrom0to1);
pb.setTitle2("new subtitle display!")
if(pb.isCanceled())
pb.close(); // they clicked cancel
*/
function progressBar(title1,title2)
{
var result = new Object();
result.running = true;
result.p = new Window("palette");
result.p.orientation = "column";
result.p.alignChildren = "left";
> result.t1 = result.p.add("statictext",undefined,title1);
result.t2 = result.p.add("statictext",undefined,title2);
result.b = result.p.add("progressbar");
> result.c = result.p.add("button",undefined,"Cancel");
result.c.onClick = function() {
result.running = false;
}
> result.isRunning = function() { return this.running; }
result.isCanceled = function() { return !this.isRunning(); }
result.setValue = function(x) { this.b.value = x * 100; }
result.setTitle1 = function(t1) { this.t1.text = t1; }
result.setTitle2 = function(t2) { this.t2.text = t2; }
result.close = function() { this.p.close(); }
> result.p.show();
return result;
}