🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.after.effects.scripting.render
Article #55

trying to show a progress bar...

#55
From: david_van_brink
Date: Sat, 21 Mar 2009 03:42
86 lines
2691 bytes
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!

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




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;
      }
Technical Details
Message-ID: <59b85da8.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efebe,5fd00e4d3295b4ad,start
X-Google-Attributes: gid1efebe,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: david_van_brink@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.after.effects.scripting.render
Subject: trying to show a progress bar...
Message-ID: <59b85da8.-1@webcrossing.la2eafNXanI>
Date: Fri, 20 Mar 2009 20:42:45 -0700
Lines: 66
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit