• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is there any way to prevent UI updating while JSX script is running in Photoshop?

Community Beginner ,
Oct 02, 2018 Oct 02, 2018

Copy link to clipboard

Copied

Seems when we updating some contents of number of layers. It seems, photoshop consume lot of performance for updating preview in canvas.
Is there any way to stop updating while running the script?
Can we show updated preview result at the end of the script execution?

TOPICS
Actions and scripting

Views

1.9K

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
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 09, 2022 Sep 09, 2022

This is an old thread, but came up with another question. To speed up my scripts to avoid redraws, I use code to turn on and off action steps:

 

 

//function to set action playback to step by step so the screen refreshes when a dialog box comes up
function setActionToStep(){
	var idsetd = charIDToTypeID( "setd" );
		var desc1 = new ActionDescriptor();
		var idnull = charIDToTypeID( "null" );
			var ref1 = new ActionReference();
			var idPrpr = charIDToTypeID( "Prpr" );
			var idPbkO = charIDToTy
...

Votes

Translate

Translate
Adobe
Community Expert ,
Oct 02, 2018 Oct 02, 2018

Copy link to clipboard

Copied

I turn most of it off by toggling the Palette at the beginning and end of the script.  The image update seems to be a low priority when it come to Photoshop Updating all the visible palettes slows down the script 

app.togglePalettes();

JJMack

Votes

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
community guidelines
Community Expert ,
Oct 03, 2018 Oct 03, 2018

Copy link to clipboard

Copied

In addition to turning off panels, perhaps zooming in to 12800% then returning to 100% or fit on screen?

Votes

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
community guidelines
LEGEND ,
Oct 03, 2018 Oct 03, 2018

Copy link to clipboard

Copied

Why that percent of zooming?

Votes

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
community guidelines
Community Expert ,
Oct 03, 2018 Oct 03, 2018

Copy link to clipboard

Copied

To limit what is redrawn, if that is a possible slowdown factor (which is why my response was worded as a question, I’m just guessing and don’t know if it is a factor or not).

Votes

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
community guidelines
LEGEND ,
Oct 03, 2018 Oct 03, 2018

Copy link to clipboard

Copied

Other tip: zooming out before making selection by using Quick Selection Tool can accelerate making selection quite much.

Votes

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
community guidelines
People's Champ ,
Oct 03, 2018 Oct 03, 2018

Copy link to clipboard

Copied

With the panels turned off, the speed can be increased if the document is placed in a floating window with a minimum zoom and window size.

You can check.

$.hiresTimer;

for (var i = 0; i < 500; i++)

    app.activeDocument.artLayers.add();

var d = new ActionDescriptor();

var r = new ActionReference();

r.putIndex(stringIDToTypeID("snapshotClass"), 1);

d.putReference(stringIDToTypeID("null"), r);

executeAction(stringIDToTypeID("select"), d, DialogModes.NO);

alert("Done in " + ($.hiresTimer/1000000).toFixed(2) + " seconds", "Timer");

Votes

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
community guidelines
Community Expert ,
Oct 03, 2018 Oct 03, 2018

Copy link to clipboard

Copied

That would seem correct to me.  I have tried to find a way to Automate minimizing  a floating window so there would be nothing that Photoshop would need to refresh.  However theres is no interface except Photoshop UI window frame controls to do that.  There is no shortcut or menu item to minimize a window.

JJMack

Votes

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
community guidelines
New Here ,
Sep 08, 2022 Sep 08, 2022

Copy link to clipboard

Copied

Can anyone tell me how can I controll photoshop after run my script... For example I want a pannel window which have 2 button and on those button there is a function like to save image or blur or any filter I want individual...so when I run script it is not allowing photoshop to open document or other operation on photoshop... So is there any way to working in photoshop during script running

 

 

 

Votes

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
community guidelines
Community Expert ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

As mentioned in your other topic, this would require and extension panel, not a script.

Votes

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
community guidelines
New Here ,
Sep 17, 2022 Sep 17, 2022

Copy link to clipboard

Copied

so is there any way to creat a panel for photoshop cs5 version. i tried uxp developer tool but it dosen't support blow cc2020 version

Votes

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
community guidelines
Community Expert ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

This is an old thread, but came up with another question. To speed up my scripts to avoid redraws, I use code to turn on and off action steps:

 

 

//function to set action playback to step by step so the screen refreshes when a dialog box comes up
function setActionToStep(){
	var idsetd = charIDToTypeID( "setd" );
		var desc1 = new ActionDescriptor();
		var idnull = charIDToTypeID( "null" );
			var ref1 = new ActionReference();
			var idPrpr = charIDToTypeID( "Prpr" );
			var idPbkO = charIDToTypeID( "PbkO" );
			ref1.putProperty( idPrpr, idPbkO );
			var idcapp = charIDToTypeID( "capp" );
			var idOrdn = charIDToTypeID( "Ordn" );
			var idTrgt = charIDToTypeID( "Trgt" );
			ref1.putEnumerated( idcapp, idOrdn, idTrgt );
		desc1.putReference( idnull, ref1 );
		var idT = charIDToTypeID( "T   " );
			var desc2 = new ActionDescriptor();
			var idperformance = stringIDToTypeID( "performance" );
			var idperformance = stringIDToTypeID( "performance" );
			var idstepByStep = stringIDToTypeID( "stepByStep" );
			desc2.putEnumerated( idperformance, idperformance, idstepByStep );
		var idPbkO = charIDToTypeID( "PbkO" );
		desc1.putObject( idT, idPbkO, desc2 );
	executeAction( idsetd, desc1, DialogModes.NO );
}//end function 

// function to return action to accelerated mode - no refresh of screen for each step.=======================================================
function setActionToAcc(){
	var idsetd = charIDToTypeID( "setd" );
		var desc3 = new ActionDescriptor();
		var idnull = charIDToTypeID( "null" );
			var ref2 = new ActionReference();
			var idPrpr = charIDToTypeID( "Prpr" );
			var idPbkO = charIDToTypeID( "PbkO" );
			ref2.putProperty( idPrpr, idPbkO );
			var idcapp = charIDToTypeID( "capp" );
			var idOrdn = charIDToTypeID( "Ordn" );
			var idTrgt = charIDToTypeID( "Trgt" );
			ref2.putEnumerated( idcapp, idOrdn, idTrgt );
		desc3.putReference( idnull, ref2 );
		var idT = charIDToTypeID( "T   " );
			var desc4 = new ActionDescriptor();
			var idperformance = stringIDToTypeID( "performance" );
			var idperformance = stringIDToTypeID( "performance" );
			var idaccelerated = stringIDToTypeID( "accelerated" );
			desc4.putEnumerated( idperformance, idperformance, idaccelerated );
		var idPbkO = charIDToTypeID( "PbkO" );
		desc3.putObject( idT, idPbkO, desc4 );
	executeAction( idsetd, desc3, DialogModes.NO );
}//end function

 

Votes

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
community guidelines
Explorer ,
Mar 17, 2023 Mar 17, 2023

Copy link to clipboard

Copied

Thanks a lot this is working for update windows and not all the UI and composition of the PSD. Is very fast.

Votes

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
community guidelines
Community Beginner ,
Apr 06, 2023 Apr 06, 2023

Copy link to clipboard

Copied

Thanx for the script. The "Acc"-mode is speeding up some actions nicely. I noticed though that for some reason the "Step"-mode seams to make actions even slower than they used to be. Is that possible? What parameter(s) is the step-mode actually setting? Can i control that manually? Any info on this is very much appreciated.

Votes

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
community guidelines
Community Expert ,
Apr 06, 2023 Apr 06, 2023

Copy link to clipboard

Copied

LATEST
quote

Thanx for the script. The "Acc"-mode is speeding up some actions nicely. I noticed though that for some reason the "Step"-mode seams to make actions even slower than they used to be. Is that possible? What parameter(s) is the step-mode actually setting? Can i control that manually? Any info on this is very much appreciated.


By @k11715897

 

The script is referencing the following action playback options:

 

action-playback.png

As you can see from the GUI screenshot, "accelerated" and "stepByStep" have no params.

Votes

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
community guidelines