Skip to main content
Known Participant
October 18, 2012
Answered

progress bar to update as script runs

  • October 18, 2012
  • 1 reply
  • 4493 views

Hi, I'd like to have a progress bar being displayed as my script runs. I created a simple progress bar as follows:

var win = new Window("palette", "SnpCreateProgressBar", [150, 150, 600, 260]);

win.pnl = win.add("panel", [10, 10, 440, 100], "Script Progress");

win.pnl.progBar = win.pnl.add("progressbar", [20, 35, 410, 60], 0, 100);

win.pnl.progBarLabel = win.pnl.add("statictext", [20, 20, 320, 35], "0%");

win.show();

                    while(win.pnl.progBar.value < win.pnl.progBar.maxvalue)

                    {

                              // this is what causes the progress bar increase its progress

                              win.pnl.progBar.value++;

            win.pnl.progBarLabel.text = win.pnl.progBar.value+"%";

                              $.sleep(10);

                    }

    alert('Done!');

win.close();

Now, if I target the ExtendScript Toolkit, I can see the "animation" of the bar progressing. But If I target illustrator, I only see when it's at 0% and then it jump to 100%. Is there a way to update the information visually as the script progresses?

Thanks!

I'm running CS6 on mac.

This topic has been closed for replies.
Correct answer CarlosCanto

I was thinking

win.update();

but didn't make a difference, your sample works good, I can see the animation with or without it. CS5 windows.

1 reply

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
October 18, 2012

I was thinking

win.update();

but didn't make a difference, your sample works good, I can see the animation with or without it. CS5 windows.

dovidgoldAuthor
Known Participant
October 19, 2012

Thanks Carlos!

That did the trick for me. Now my progress bar updates while running a script in illustrator.