Reputation: 21
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.
Upvotes: 1
Views: 1884
Reputation: 2797
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%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\brushBlendModes.ahk
Upvotes: 0
Reputation: 31
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 );
Upvotes: 3