0

I have got my script to work and I just want to add a progressbar to show the progress (duh!). This is a test script I made because I discovered the problem in my original script. In the original script there is a lot of opening,saving,copy,paste and transformations in the loop...

var StatusWindow = new Window("window","Production");

StatusWindow.size = [400,150];
StatusWindow.alignChildren = "left";
StatusWindow.TextProgress = StatusWindow.add("statictext",[0,0,200,0]);
StatusWindow.BarProgress = StatusWindow.add("progressbar",[0,0,200,12]);
StatusWindow.show();

for (n=0; n<100; n++) {
  StatusWindow.TextProgress.text = n;
  StatusWindow.BarProgress.value = n;
  $.sleep(100);
}
alert("Done!);

The script runs and shows the Window and the progressbar. Then nothing is updated in the UI until the alert box shows up. If I pause the script (whitin ExtendScript Toolkit CS5), the UI is updated with thext and correct progress. I know that an UI normaly only get updated when there is time "left over" in the system, but this is ridiculous!!!

How can I force Photoshop to update the UI when I want it too?

//Thanks.

RobC
  • 22,977
  • 20
  • 73
  • 80
Max Kielland
  • 5,627
  • 9
  • 60
  • 95

2 Answers2

1

(From the JavaScript Tools guide) You can use StatusWindow.update()

spencewah
  • 2,196
  • 4
  • 20
  • 31
0

You may want to consider using app.refresh() or waitForRedraw(). The window.update() did not seem to solve this problem for me.

Here is the source: http://www.davidebarranca.com/2012/10/scriptui-window-in-photoshop-palette-vs-dialog/

user3526
  • 1,412
  • 1
  • 19
  • 26