Trying to delete history state with a dialog button
Hi,
according to the script at the link below:
In addition to the script found at the link above I have added a Cancel button where it has to delete the history state upon closing the dialog:
buttonCancel = dialog.add("button"); buttonCancel.text = "Cancel";
buttonCancel.preferredSize.width = 80;
buttonCancel.onClick = function(){
//Select current history state
ref1 = new ActionReference();
desc1 = new ActionDescriptor();
ref1.putProperty(cTID('HstS'), cTID('CrnH'));
desc1.putReference(cTID('null'), ref1);
executeAction(cTID('slct'), desc1, DialogModes.NO);
//Delete selected history state
ref2 = new ActionReference();
desc2 = new ActionDescriptor();
ref2.putProperty(cTID('HstS'), cTID('CrnH'));
desc2.putReference(cTID('null'), ref2);
executeAction(cTID('Dlt '), desc2, DialogModes.NO);
dialog.close();
}
The code simply does nothing except closing the dialog box.
In addition, I would like to know how to create a condition for what histrory state to be deleted upon closing the dialog box.
Thanks,
Damian
