skip to Main Content

really a beginner at photoshop scripting.

Right now I’m making some scripts that are useful to me with my workflow like visibility toggle stuffs.

What I really wanted to know now is how to change not the ‘Layer Blending Mode’, but the ‘Brush Mode'(like normal, multiply, clear, etc…) using javascript. I can’t seem to find some resources to control the brush modes.

Hope you guys can help me and shed some light in this matter.

2

Answers


  1. It is possible, here’s a snippet I pieced together, it works by creating an action and executing it. (Normally changing a brush mode can’t be done with regular actions, but it does work like this in CC 2017)

    var bmsS = ["normal", "dissolve", "behind", "clearEnum",
                "darken", "multiply", "colorBurn", "linearBurn", "darkerColor",
                "lighten", "screen", "colorDodge", "linearDodge", "lighterColor",
                "overlay", "softLight", "hardLight", "vividLight", "linearLight", "pinLight", "hardMix",
                "difference", "exclusion", "blendSubtraction", "blendDivide",
                "hue", "saturation", "color", "luminosity",  ]; 
    
    // Select the paint brush tool
    var idslct = stringIDToTypeID( "select" );
    var desc226 = new ActionDescriptor();
    var idnull = stringIDToTypeID( "null" );
    var ref170 = new ActionReference();
    var idPbTl = stringIDToTypeID( "paintbrushTool" );
    ref170.putClass( idPbTl );
    desc226.putReference( idnull, ref170 );
    executeAction( idslct, desc226, DialogModes.NO );
    
    // blend mode
    var desc = new ActionDescriptor();
    var idset = stringIDToTypeID( "set" );
    //alert(desc.getEnumerationValue(stringIDToTypeID("mode")));
    desc.putEnumerated(stringIDToTypeID("mode"), stringIDToTypeID("blendModel"), stringIDToTypeID("clearEnum"));
    desc226.putObject( stringIDToTypeID( "to" ), stringIDToTypeID( "null" ), desc);
    executeAction( idset, desc226, DialogModes.NO );
    
    Login or Signup to reply.
  2. I ran in to the same limitations and used AutoHotkey to get around them.

    This script sets Shift+e to Alt+Shift+r (clear brush mode) and Shift+r to Alt+Shift+n (normal brush mode).

    Download AutoHotkey, save the script below as a .ahk, and double click it.

    #IfWinActive ahk_class Photoshop
    
    +e::
        Send, {Shift Down}{Alt Down}r
        Send, {Shift Up}{Alt Up}
    Return
    
    +r::
        Send, {Shift Down}{Alt Down}n
        Send, {Shift Up}{Alt Up}
    Return
    
    #IfWinActive
    

    If you want it to run on startup, you can save it to the windows startup folder:

    C:Users%username%AppDataRoamingMicrosoftWindowsStart MenuProgramsStartupbrushBlendModes.ahk
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search