Copy link to clipboard
Copied
I am doing a set of instructions on each layer in my document and when Photoshop is in the front, and I can see the things happening, and the instructions for each layer take about 1 second each. I noticed that when Photoshop was minimized, the instructions were much, much faster. I was wondering if I could, through script, disable the screen update and then when I was finished, re-enable the update?
Thanks in advance
Carl
Copy link to clipboard
Copied
Here are several things you can do to make the script run faster. First make sure the playback options are set to accelerated. Here is some code from Xbytor
cTID = 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.setPlaybackAcclerated = function() {
Stdlib.setActionPlaybackOptions("accelerated");
};
Stdlib.setPlaybackStepByStep = function() {
Stdlib.setActionPlaybackOptions("stepByStep");
};
Stdlib.setPlaybackPaused = function(delaySec) {
Stdlib.setActionPlaybackOptions("pause", delaySec);
};
next togglePalettes() to hide the palettes.
And set doc view to as small as it will go. This doesn't help that much so may not be worth the effort.
runMenuItem( charIDToTypeID("ActP") );// fit on screen
for(var z = 0; z < 17;z++){
runMenuItem( charIDToTypeID("ZmOt") );
}
But even with all that, working with layers using the scripting API can be slow.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now