🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.after.effects.scripting.render
3 messages
3 total messages Started by david_van_brink Sat, 21 Mar 2009 03:42
trying to show a progress bar...
#55
Author: 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;
      }
Re: trying to show a progress bar...
#56
Author: Jeff_Almasol
Date: Sat, 21 Mar 2009 22:06
5 lines
734 bytes
hi david,

try calling the Window's update() method in your loop. this can be necessary if you're running the script on a Mac.

:jeff
Re: trying to show a progress bar...
#57
Author: david_van_brink
Date: Mon, 23 Mar 2009 06:50
3 lines
899 bytes
As usual, thanks, that worked perfectly Jeff!

(I've gotten a midi-file parser working in ExtendScript, will post soon. Fun fact: adding a keyframe in AE is approximately very much slower than adding a point to a path in Illustrator. Illustrator is fast fast fast.)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads