Copy link to clipboard
Copied
Hello friends! How to check if the current document has a snapshot named "Initial Color"? If it already exists, do nothing, and if it does not exist, add it.
Hi tokuredit,
Hope this will help..
...var doc = app.activeDocument;
var hs = doc.historyStates;
var flg=0;
for(var a =hs.length-1;a>=0;--a){
if(hs.snapshot) {
doc.activeHistoryState = hs;
delHist();
flg=1
}
}
}
if(flg==0){
// Put your code here.....
}
function delHist() {
var desc20 = new ActionDescriptor();
var ref23 = new ActionReference();
ref23.putProperty( charIDToTypeID('HstS'), charIDToTypeID('CrnH') );
des
Copy link to clipboard
Copied
Hi tokuredit,
Hope this will help..
var doc = app.activeDocument;
var hs = doc.historyStates;
var flg=0;
for(var a =hs.length-1;a>=0;--a){
if(hs.snapshot) {
doc.activeHistoryState = hs;
delHist();
flg=1
}
}
}
if(flg==0){
// Put your code here.....
}
function delHist() {
var desc20 = new ActionDescriptor();
var ref23 = new ActionReference();
ref23.putProperty( charIDToTypeID('HstS'), charIDToTypeID('CrnH') );
desc20.putReference( charIDToTypeID('null'), ref23 );
executeAction( charIDToTypeID('Dlt '), desc20, DialogModes.NO );
};
-yajiv
Copy link to clipboard
Copied
Great, it worked very well! I just removed line 8 and the last 7 to work as I need it! Helped me a lot. Thank you very much natrev