Suspend History States
Is there a way to stop the steps in a script showing up in the history.
I have seen other posts talking about suspendHistory but `i am not that familiar with how to use that call
Is there a way to stop the steps in a script showing up in the history.
I have seen other posts talking about suspendHistory but `i am not that familiar with how to use that call
Say that you need to run the following code:
var doc = app.activeDocument;
var lay = doc.activeLayer;
var dup = lay.duplicate();
dup.name = "Friday";
dup.applyGaussianBlur (20);
alert("Too much wine");
This leaves 3 steps in the History palette.
The suspendHistory() method accepts two params: the string that is going to appear in the History palette in lieu of the 3 "normal" steps; and the 6 lines of ExtendScript I've written above. E.g.
app.activeDocument.suspendHistory('Swing', 'var doc = app.activeDocument; var lay = doc.activeLayer; var dup = lay.duplicate(); dup.name = "Friday"; dup.applyGaussianBlur (20); alert("Too much wine");'
Usually you won't stick that much code into a string, so the following is the usual pattern:
function main() {
var doc = app.activeDocument;
var lay = doc.activeLayer;
var dup = lay.duplicate();
dup.name = "Friday";
dup.applyGaussianBlur (20);
alert("Too much wine");
}
app.activeDocument.suspendHistory ("Swing", "main()");
Hope this helps,
Davide
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.