Supsending UI updates

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

poslundc

Supsending UI updates

Post by poslundc »

Hi all,

I'm running a lengthy, complicated script and I see Photoshop churning just trying to keep the screen up-to-date.

Is there anyway to pause UI updates until such time as my script has completed?

Thanks,

Dan.
Mike Hale

Supsending UI updates

Post by Mike Hale »

In the GUI you can set the playback option in the action panel to accelerated.

Or you can use Xbytor's functions to do the same inside the script
Code: Select allcTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };

Stdlib = function Stdlib() {};

Stdlib.setActionPlaybackOptions = function(opt, arg) {
  function _ftn() {
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putProperty(cTID("Prpr"), cTID("PbkO"));
    ref.putEnumerated(cTID("capp"), cTID("Ordn"), cTID("Trgt"));
    desc.putReference(cTID("null"), ref );
    var pdesc = new ActionDescriptor();
    pdesc.putEnumerated(sTID("performance"), sTID("performance"), sTID(opt));
    if (opt == "pause" && arg != undefined) {
      pdesc.putInteger(sTID("pause"), parseInt(arg));
    }
    desc.putObject(cTID("T "), cTID("PbkO"), pdesc );
    executeAction(cTID("setd"), desc, DialogModes.NO);
  }
  _ftn();
};
Stdlib.setPlaybackAccelerated = function() {
  Stdlib.setActionPlaybackOptions("accelerated");
};
Stdlib.setPlaybackStepByStep = function() {
  Stdlib.setActionPlaybackOptions("stepByStep");
};
Stdlib.setPlaybackPaused = function(delaySec) {
  Stdlib.setActionPlaybackOptions("pause", delaySec);
};
cmyk

Supsending UI updates

Post by cmyk »

Not sure if you can pause the UI, but you could try hiding the palettes temporarily by using workspaces. Save a workspace in your normal working environment and another without any palettes visible. At the beginning of the script call the hidden palette workspace and at the end of the script call your regular workspace. Maybe even add a zoom to 8.33% or smaller magnification so the screen has less canvas area to refresh.