Copy link to clipboard
Copied
I added to the bar element, the Progressbar. It works, all is well.
One of the functions has a loop, like
for (var i=0;i<myArray.length;i++) {
myProgressBar.value = (i+1)*(100/myArray.length);
}
When the panel is opened and script is executed, the value of the progress bar is zero after the loop ends, the value of the progress bar from 100.
I also tried adding alert(""); for each iteration of the loop, then the value of the progress bar with each step of the cycle is updated. What could be wrong?
Copy link to clipboard
Copied
Inside your loop you must call your window's update(); function to update the panel.
So if you create your window like this:
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "My Panel Name", [160, 160, 10, 10]);
Your loop would look like this:
for (var i=0;i<myArray.length;i++) {
myProgressBar.value = (i+1)*(100/myArray.length);
myPanel.update();
}
Copy link to clipboard
Copied
... and please note, that you can only update floating windows, not dockable panels. .update is a window only function. (sadly!)
But you can launch a window, while your loop is running, which as a progess bar.
Cheers,
Martin
Copy link to clipboard
Copied
Yes I discovered this after I posted. It's a peculiar restriction Adobe have imposed here.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now