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

Blocking the refresh of photoshop

Guest
Jun 08, 2012 Jun 08, 2012

Copy link to clipboard

Copied

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

Views

1.7K

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
Adobe
Community Expert ,
Jun 12, 2012 Jun 12, 2012

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

Thank you.  That solved my problem.

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

Copy link to clipboard

Copied

Chuck Uebele:

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

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

LATEST

Thanks David... now it makes sense.

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

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