Highlighted

Photoshop won't update scriptUI or CEP panel while running a script.

New Here ,
Jun 15, 2020

Copy link to clipboard

Copied

Hi,

My goal is to create a progress window, a realtime report of what the script is doing while running. This includes a progress bar and status text.

I Made one using scriptUI that auto-opens/closes progress windows, and showed realtime feedback with very good performance.

The refresh time was below 1ms!

But it only worked for CC2018/CC2019. In CC2020 the window stopped updating, and would only update when photoshop is doing some heavy stuff like scaling. Basically when the script logic is waiting for Photoshop, only then it is updating it's UI.

I thought a solution was to make a HTML CEP extension panel to replace the limited scriptUI stuff, and use the PlugPlugExternalObject to dispatch an custom JSX event, and an eventListener in de CEP progress window. But to the same effect, it's only dispatching or receiving all the events at ones, ones the script is finished running, so for example, the script starts, dispatches 50 reports while running, nothing happens for a full minute, the script is done, and the panel starts updating, showing all the messages in a flash at onces.

For some reason CC2020 prevents scriptUI panels from updating, and CEP panels are on "pauze" while a script is running in photoshop...?

A simple realtime progress report while a script is running seems much more complicated that I thought.

Does anyone have any idea on how to proceed from here?

TOPICS
Actions and scripting, Feature request, Performance, SDK

Views

171

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Photoshop won't update scriptUI or CEP panel while running a script.

New Here ,
Jun 15, 2020

Copy link to clipboard

Copied

Hi,

My goal is to create a progress window, a realtime report of what the script is doing while running. This includes a progress bar and status text.

I Made one using scriptUI that auto-opens/closes progress windows, and showed realtime feedback with very good performance.

The refresh time was below 1ms!

But it only worked for CC2018/CC2019. In CC2020 the window stopped updating, and would only update when photoshop is doing some heavy stuff like scaling. Basically when the script logic is waiting for Photoshop, only then it is updating it's UI.

I thought a solution was to make a HTML CEP extension panel to replace the limited scriptUI stuff, and use the PlugPlugExternalObject to dispatch an custom JSX event, and an eventListener in de CEP progress window. But to the same effect, it's only dispatching or receiving all the events at ones, ones the script is finished running, so for example, the script starts, dispatches 50 reports while running, nothing happens for a full minute, the script is done, and the panel starts updating, showing all the messages in a flash at onces.

For some reason CC2020 prevents scriptUI panels from updating, and CEP panels are on "pauze" while a script is running in photoshop...?

A simple realtime progress report while a script is running seems much more complicated that I thought.

Does anyone have any idea on how to proceed from here?

TOPICS
Actions and scripting, Feature request, Performance, SDK

Views

172

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 15, 2020 0
Adobe Community Professional ,
Jun 15, 2020

Copy link to clipboard

Copied

Hi,

I am not sure how you are creating the progress bar in JSX. But I have progres bar code and running in Photoshop 2020 as well. Try the following snippet. To see the progress bar is updating you need to put a break point inside the for loop, otherwise it will not be visible. 

PROGRESSBAR = {};

if (typeof PROGRESSBAR.initialiseProgressBar !== 'function') {
    PROGRESSBAR.initialiseProgressBar = function () {
        PROGRESSBAR.progressBar = null;
        PROGRESSBAR.progressBarCount =  1;
    }
}

if (typeof PROGRESSBAR.showProgressBar !== 'function') {
    PROGRESSBAR.showProgressBar = function (message, fullLength) {
        var win, windowResource;
		windowResource = "palette {  \
				orientation: 'column', \
				alignChildren: ['fill', 'top'],  \
				preferredSize:[160, 70], \
				text: '" + message + "',  \
				margins:15, \
				\
			}"
		win = new Window(windowResource);
		progLabel = win.add('statictext', undefined, message);
		progBar = win.add('progressbar', undefined, 10, fullLength);
		progBar.size = [450, 10];
		this.progressBar = win;
		win.show();
		return win;
    }
}


if (typeof PROGRESSBAR.updateProgressBar !== 'function') {
    PROGRESSBAR.updateProgressBar = function (message) {
        this.progressBar.show();
		progLabel.text = message;
		progBar.value = this.progressBarCount++;
		this.progressBar.update();
    }
}


if (typeof PROGRESSBAR.closeProgressBar !== 'function') {
    PROGRESSBAR.closeProgressBar = function () {
        this.progressBar.close();
    }
}

PROGRESSBAR.initialiseProgressBar ();
PROGRESSBAR.showProgressBar("Test", 15)
for(var i=0;i<15;i++){
 PROGRESSBAR.updateProgressBar("New Message"); // use break point her to see updating
}
 PROGRESSBAR.closeProgressBar();

Let us know if this works for you.

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 15, 2020 1
New Here ,
Aug 13, 2020

Copy link to clipboard

Copied

Hi Charu,

 

What do you mean by "a break point"? I can't figure out how your pasted script is intended to work.

 

As-is, it just runs in the background until it finishes the loop, then displays the progress bar at the very end (i = 14). Same result if I add a 'debugger;' into the loop. If I add a 'break' in the for loop, it ends immediately (i = 0).

 

I'm not seeing any movement of progress no matter what I add.

 

Help appreciated,

Thanks.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 13, 2020 0
Adobe Community Professional ,
Aug 13, 2020

Copy link to clipboard

Copied

Hi,

It is difficult to explain in words. Yes, by break points it means, to add debugger in side the loop and to see the changes in the progress bar you need to go back to the Photoshop to make it active. So while debugging it will be difficult to see, but when intergrated with CEP panles it is quite easily visible. I have added link to the video where I have shown how it is updating and how I am debugging to show that progress bar is updating.

 

https://www.dropbox.com/s/kf4n2g51u8clr60/Progressbar%20Video.mov?dl=0

 

I hope this helps

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 13, 2020 0