Copy link to clipboard
Copied
Hello!
Can someone help me with a script to select the Spot Healing Brush Tool with the "darken" mode in Photoshop? I have been able to select this tool as shown below, but I still can't switch it to the "darken" mode. Thank you very much!
try {
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var ret = executeActionGet(r);
var options = ret.getObjectValue(stringIDToTypeID("currentToolOp
...
Copy link to clipboard
Copied
try {
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var ret = executeActionGet(r);
var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));
var tool = ret.getEnumerationType(stringIDToTypeID("tool"));
options.putEnumerated(stringIDToTypeID("mode"), stringIDToTypeID("blendMode"), stringIDToTypeID("darken"));
var r = new ActionReference();
r.putClass(tool);
var d = new ActionDescriptor();
d.putReference(stringIDToTypeID("null"), r);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), options);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
}
catch(e) { alert(e); }
Copy link to clipboard
Copied
@r-bin – I can confirm that your code does correctly set the tool blend mode to Darken.
P.S. On a related note, other topics including basic tool selection can be found here:
https://community.adobe.com/t5/photoshop/script-call-dodge-amp-burn/m-p/10776697
https://www.ps-scripts.com/viewtopic.php?f=68&t=11342&p=64930
Here is a topic where opacity is set:
Copy link to clipboard
Copied
@Stephen_A_Marsh , the last link (regarding the Clone Stamp Tool) seems to be the one you already posted regarding the Dodge and Burn Tools.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you very much, the code you provided has worked.
Copy link to clipboard
Copied
Please remember to mark a »Correct Answer« as such.
Copy link to clipboard
Copied
Thank you for the reminder! I'll make sure to mark the correct answer.