If I use the first time or use again this script, I must reset history and delete activeHistoryBrushSource if there is one.
How can I reset (or delete) the activeHistoryBrushSource?
If it not exist or if it exist, it must not give me any error.
// here I need to delete activeHistoryBrushSource only if it exists savedState = doc.activeHistoryState doc.activeLayer.applyDustAndScratches(16,0); // only an example doc.activeHistoryBrushSource = doc.activeHistoryState doc.activeHistoryState = savedState
delete activeHistoryBrushSource if there is one.
I suspect you cannot delete that, as it always is something, but you could set it so something else – the activeHistoryState?
And may I ask if what you are achieving with this Script might not just as well be done with Layers and Layer Masks (and then flattened if necessary)?
DustAndScratches was just an example.
I have made it already and I have just did it with listener:
It makes historybrush OFF from any history state.
var desc6 = new ActionDescriptor();
var ref5 = new ActionReference();
ref5.putProperty( charIDToTypeID( "HstS" ), charIDToTypeID( "HstB" ));
desc6.putReference( charIDToTypeID( "null" ), ref5 );
executeAction( charIDToTypeID( "Cler" ), desc6, DialogModes.NO );