Set color replacement tool
I would like to change the data of the color replacement tool brush

with a script
I know it can be done with a .tpl file
But I've seen somewhere in the past that it can be done with a script
can someone help me
I would like to change the data of the color replacement tool brush

with a script
I know it can be done with a .tpl file
But I've seen somewhere in the past that it can be done with a script
can someone help me
Mr. r-bin
I also use this tool a lot and every time I have to change all the settings
so if you can do it with scripts it would help me
more than anything else, it's a lesson in programming a script
thank you
I do not set parameters for the tools, because it doesn't work in CS6. Only setting parameters for the brush descriptor works.
Here is the complete code for this tool. I think you yourself will figure out where and what.
var op = new ActionDescriptor();
op.putEnumerated(charIDToTypeID("CRTm"), stringIDToTypeID("blendMode"), stringIDToTypeID("color")); // hue, saturation, color, luminosity
op.putInteger(stringIDToTypeID("tolerance"), 30);
op.putInteger(charIDToTypeID("CRSm"), 0); // sampling options: 0,1,2
op.putInteger(charIDToTypeID("CRCg"), 1); // limits: 0,1,2
op.putBoolean(charIDToTypeID("CRAl"), true); // anti-alias
/************** these parameters can be omitted, all or part
op.putEnumerated(stringIDToTypeID("mode"), stringIDToTypeID("blendMode"), stringIDToTypeID("revert")); // it is not known why
var CRRc = new ActionDescriptor();
CRRc.putDouble(stringIDToTypeID("red"), 0);
CRRc.putDouble(stringIDToTypeID("green"), 0);
CRRc.putDouble(stringIDToTypeID("blue"), 0);
op.putObject(charIDToTypeID("CRRc"), stringIDToTypeID("RGBColor"), CRRc);
var CRTc = new ActionDescriptor();
CRTc.putDouble(stringIDToTypeID("red"), 0);
CRTc.putDouble(stringIDToTypeID("green"), 0);
CRTc.putDouble(stringIDToTypeID("blue"), 0);
op.putObject(charIDToTypeID("CRTc"), stringIDToTypeID("RGBColor"), CRTc);
op.putBoolean(stringIDToTypeID("usePaintDynamics"), true);
op.putBoolean(stringIDToTypeID("useBrushPose"), false);
op.putDouble(stringIDToTypeID("smoothingValue"), 0);
op.putBoolean(stringIDToTypeID("smoothingRadiusMode"), false);
op.putBoolean(stringIDToTypeID("smoothingCatchup"), true);
op.putBoolean(stringIDToTypeID("smoothingCatchupAtEnd"), false);
op.putBoolean(stringIDToTypeID("smoothingZoomCompensation"), true);
op.putBoolean(stringIDToTypeID("pressureSmoothing"), false);
op.putBoolean(stringIDToTypeID("usePressureOverridesSize"), false);
op.putBoolean(stringIDToTypeID("usePressureOverridesOpacity"), false);
op.putBoolean(stringIDToTypeID("useLegacy"), false);
// brush settings
var brush = new ActionDescriptor();
brush.putUnitDouble(stringIDToTypeID("diameter"), stringIDToTypeID("pixelsUnit"), 13);
brush.putUnitDouble(stringIDToTypeID("hardness"), stringIDToTypeID("percentUnit"), 100);
brush.putUnitDouble(stringIDToTypeID("angle"), stringIDToTypeID("angleUnit"), 0);
brush.putUnitDouble(stringIDToTypeID("roundness"), stringIDToTypeID("percentUnit"), 100);
brush.putUnitDouble(stringIDToTypeID("spacing"), stringIDToTypeID("percentUnit"), 25);
brush.putBoolean(charIDToTypeID("Intr"), true);
brush.putBoolean(stringIDToTypeID("flipX"), false);
brush.putBoolean(stringIDToTypeID("flipY"), false);
op.putObject(stringIDToTypeID("brush"), stringIDToTypeID("computedBrush"), brush);
op.putBoolean(stringIDToTypeID("useTipDynamics"), true);
op.putBoolean(stringIDToTypeID("flipX"), false);
op.putBoolean(stringIDToTypeID("flipY"), false);
op.putBoolean(stringIDToTypeID("brushProjection"), false);
op.putUnitDouble(stringIDToTypeID("minimumDiameter"), stringIDToTypeID("percentUnit"), 0);
op.putUnitDouble(stringIDToTypeID("minimumRoundness"), stringIDToTypeID("percentUnit"), 25);
op.putUnitDouble(stringIDToTypeID("tiltScale"), stringIDToTypeID("percentUnit"), 200);
var prVr = new ActionDescriptor();
prVr.putInteger(charIDToTypeID("bVTy"), 0);
prVr.putInteger(charIDToTypeID("fStp"), 25);
prVr.putUnitDouble(stringIDToTypeID("jitter"), stringIDToTypeID("percentUnit"), 0);
prVr.putUnitDouble(stringIDToTypeID("minimum"), stringIDToTypeID("percentUnit"), 0);
op.putObject(charIDToTypeID("prVr"), charIDToTypeID("brVr"), prVr);
var szVr = new ActionDescriptor();
szVr.putInteger(charIDToTypeID("bVTy"), 2);
szVr.putInteger(charIDToTypeID("fStp"), 25);
szVr.putUnitDouble(stringIDToTypeID("jitter"), stringIDToTypeID("percentUnit"), 0);
szVr.putUnitDouble(stringIDToTypeID("minimum"), stringIDToTypeID("percentUnit"), 0);
op.putObject(charIDToTypeID("szVr"), charIDToTypeID("brVr"), szVr);
var angleDynamics = new ActionDescriptor();
angleDynamics.putInteger(charIDToTypeID("bVTy"), 0);
angleDynamics.putInteger(charIDToTypeID("fStp"), 25);
angleDynamics.putUnitDouble(stringIDToTypeID("jitter"), stringIDToTypeID("percentUnit"), 0);
angleDynamics.putUnitDouble(stringIDToTypeID("minimum"), stringIDToTypeID("percentUnit"), 0);
op.putObject(stringIDToTypeID("angleDynamics"), charIDToTypeID("brVr"), angleDynamics);
var roundnessDynamics = new ActionDescriptor();
roundnessDynamics.putInteger(charIDToTypeID("bVTy"), 0);
roundnessDynamics.putInteger(charIDToTypeID("fStp"), 25);
roundnessDynamics.putUnitDouble(stringIDToTypeID("jitter"), stringIDToTypeID("percentUnit"), 0);
roundnessDynamics.putUnitDouble(stringIDToTypeID("minimum"), stringIDToTypeID("percentUnit"), 0);
op.putObject(stringIDToTypeID("roundnessDynamics"), charIDToTypeID("brVr"), roundnessDynamics);
****************/
var r = new ActionReference();
r.putClass(stringIDToTypeID("colorReplacementBrushTool"));
var d = new ActionDescriptor();
d.putReference(stringIDToTypeID("null"), r);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), op);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.