Photoshop Scripting - Update Progress Bar in a Window

The window class dialog is a MODAL dialog and requires you to close it before the execution continues.

Use the class window to create a non-blocking window:

var win = new Window("window{text:'Progress',bounds:[100,100,400,150],bar:Progressbar{bounds:[20,20,280,31] , value:0,maxvalue:100}};");
win.show();

for(...){
    //do work here

    //update progress
    win.bar.value = ...;
}

win.close();

However, you will run into the next problem here. Depending on what you are doing in the loop, photoshop will not update the UI fast enough to see the progress bar moving. This is where I got stuck :/