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

Blocking the refresh of photoshop

Guest
Jun 08, 2012 Jun 08, 2012

Hi,

Is there a way in javascript to block the refresh of photoshop ?

I'm having a script that is hiding and showing layers, but as I have hundreds of them, and photoshop refreshing the interface each time I change the visibility of a layer, it gets extremly slow ...

I'm only interested but the end result, not the in-between steps.

If you have any idea, please let me know !

Thanks a lot,

Julien

TOPICS
Actions and scripting
1.9K
Translate
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
Adobe
Community Expert ,
Jun 12, 2012 Jun 12, 2012

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 );

Translate
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 ,
Dec 17, 2012 Dec 17, 2012

I have CS6 on Win 7 64 bit and the above code gives me an error: illegal argument.

Any help?  My scripts are running quite slow due to all of the image refreshing and I'd love to be able to block that.

Translate
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
Guru ,
Dec 18, 2012 Dec 18, 2012

Some times this forum's software strips out what it thinks are extra spaces in text. Make sure that charIDToTypeID( "T   " ) has 3 spaces inside the quotes. CharIDs must have 4 characters.

Translate
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 ,
Dec 18, 2012 Dec 18, 2012

Thank you.  That solved my problem.

Translate
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
Enthusiast ,
Sep 10, 2017 Sep 10, 2017

Chuck Uebele:

I tried this code but I didn't see a change. Isn't it turned on by default in last Photoshop versions?

Translate
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 10, 2017 Sep 10, 2017

It might be. I haven't really checked but I know I used to have to put it in some of my scripts so that they would change from acceleration mode to step mode for things like manual cropping, and some other applications.

Translate
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 11, 2017 Sep 11, 2017

This is equivalent of setting the PlaybackOptions in the Actions panel:

DB 2017-09-11 at 12.43.28.png

The code it gives in the SL (cleaned) is as follows – CC2017:

var s2t = function (s) {

  return app.stringIDToTypeID(s);

  };

  var descriptor = new ActionDescriptor();

  var reference = new ActionReference();

  var descriptor2 = new ActionDescriptor();

  reference.putProperty( s2t( "property" ), s2t( "playbackOptions" ));

  reference.putEnumerated( s2t( "application" ), s2t( "ordinal" ), s2t( "targetEnum" ));

  descriptor.putReference( s2t( "null" ), reference );

  descriptor2.putEnumerated( s2t( "performance" ), s2t( "performance" ), s2t( "accelerated" ));

  descriptor.putObject( s2t( "to" ), s2t( "playbackOptions" ), descriptor2 );

  executeAction( s2t( "set" ), descriptor, DialogModes.NO );

Hope this helps,

Davide

Davide Barranca - PS developer and author
www.ps-scripting.com
Translate
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
Enthusiast ,
Sep 11, 2017 Sep 11, 2017
LATEST

Thanks David... now it makes sense.

So I assume that scripts in modern Photoshop are accelerated by default.

Translate
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