Skip to main content
Inspiring
January 23, 2010
Question

JS ScriptUI CS4: How to create an indeterminate progress bar?

  • January 23, 2010
  • 2 replies
  • 14947 views

Hi Folks,

Does anyone here know if ExtendScript (I'm using the CS4 flavor of ES) can produce an indeterminate (i.e., "barber pole") progress bar using ScriptUI's progressbar control? I've tried a number of value settings for the progress bar control in hopes that they would trigger the barber pole behavior, but so far, no luck.

My current workaround is to "loop" the progress indicator. In other words, when the progress bar's value > maxvalue, I reset the value back to minvalue. Then rinse and repeat. Not really what I want, but the task being processed takes quite a bit of time, so I need to show some sign of something happening to the user.

Thanks!

-- Jim

This topic has been closed for replies.

2 replies

Vamitul
Legend
September 6, 2012

sorry to bump an old thread, but i was hoping someone made some progress in this matter.

i'm in the same situation, i need a indeterminate progress bar for a script, i'we tried using a swf for it, but it only shows after the script has finished running. I can't update de palette/dialog/whatever very often, since my script basicly exports about 5 or 6 PDF's form very large documents, so the ony time i can update is when one PDF is exported, and that will not do.

Community Expert
September 6, 2012

@Vamitul – it's not about ScriptUI and might be no real help, but you could run the export in the foreground where the "normal" UI progress bar is showing up with the page names and some other statements…

For that use the old "exportFile()" method instead of the "asynchronousExportFile()" method.

Uwe

Inspiring
September 6, 2012

Vamitul,

I agree with what Laubender wrote...use the document.exportFile() function to do the exporting. I use that frequently. This gives you the progress bar for free.

-- Jim

ramkumar_vp
Inspiring
January 23, 2010

Hi Jim,


Please see below the sample progressbar script.


     myPrs = new Window('palette', 'Batch Processing');
     myPrs.orientation = 'column';
     myPrs.alignment = 'right';
     myPrs.ProcessHead  = myPrs.add('statictext',[40,0,260,25], "Batch Processing...");
     myPrs.Process = myPrs.add("progressbar",[40,40,260,65]);
     myPrs.Label = myPrs.add('statictext', [150,75,200,120], "0%");
     myPrs.Process.value = 0;

     var LENGTH = 4;

     myPrs.show();

     for(i=0;i<10;i++){
         var PrCounter = 0;
         ProgressBar(++PrCounter, i+1 , 10);
         Function1();
         ProgressBar(++PrCounter, i+1 , 10);
         Function1();
         ProgressBar(++PrCounter, i+1 , 10);
         Function1();
         ProgressBar(++PrCounter, i+1 , 10);
         Function1();
     }

    

     function Function1(){
         for(var i=0; i<1000000;i++){}
     }

    

     function ProgressBar(v, x, y){
         var value = (Number(v) / LENGTH) * 100;
         myPrs.Label.text = Math.round(value) + " % ";
         myPrs.ProcessHead.text = "Batch Processing... [" + x + "/"+ y + "]";
         myPrs.Process.value = value;
     }


I think this script will solve your problem.


Regards,

Ramkumar .P

Inspiring
January 23, 2010

Hi Ramkumar,

Thanks for the reply, I really appreciate your help! Your idea is similar to what I am already using, which is fine as a workaround, but its not really what I'm after.

What I'm trying to find out is if it is possible, using ExtendScript and ScriptUI, to display a indeterminate progress bar. In other words, one where my code would never have to increment its value during its processing. Basically, I'm looking for the spinning barber pole type of progress bar that spins without having to interact with it within my processing code. See the image below:

Thanks again!

-- Jim

Harbs.
Legend
January 23, 2010

I don't think you can use the standard progress bar for what you want.

It should be possible to create a swf for that...

Harbs