Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help script select spot Healing Brush Tool with "darken" mode in Photoshop

Community Beginner ,
Nov 22, 2024 Nov 22, 2024

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!

var idslct = charIDToTypeID("slct");
var desc8 = new ActionDescriptor();
var idnull = charIDToTypeID("null");
var ref1 = new ActionReference();
var idspotHealingBrushTool = stringIDToTypeID("spotHealingBrushTool");
ref1.putClass(idspotHealingBrushTool);
desc8.putReference(idnull, ref1);
executeAction(idslct, desc8, DialogModes.NO);

Screenshot_1.png
TOPICS
Actions and scripting
527
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Nov 22, 2024 Nov 22, 2024
Run this code after the code for selecting the desired tool. I can't test its functionality because I'm using an outdated version of PS, on which it doesn't work.
 

 

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
...
Translate
Adobe
People's Champ ,
Nov 22, 2024 Nov 22, 2024
Run this code after the code for selecting the desired tool. I can't test its functionality because I'm using an outdated version of PS, on which it doesn't work.
 

 

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); }

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 22, 2024 Nov 22, 2024

@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:

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 23, 2024 Nov 23, 2024

@Stephen Marsh , the last link (regarding the Clone Stamp Tool) seems to be the one you already posted regarding the Dodge and Burn Tools. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 23, 2024 Nov 23, 2024
LATEST

@c.pfaffenbichler 

 

Thanks! I have corrected the link.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 22, 2024 Nov 22, 2024

Thank you very much, the code you provided has worked.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 23, 2024 Nov 23, 2024

Please remember to mark a »Correct Answer« as such. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 23, 2024 Nov 23, 2024

Thank you for the reminder! I'll make sure to mark the correct answer.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines