Photoshop Javascript:如何使用javascript更改画笔模式?

时间:2017-06-12 20:49:14

标签: javascript photoshop photoshop-script

真的是photoshop脚本的初学者。

现在我正在使用我的工作流程(如可见性切换内容)制作一些对我有用的脚本。

我现在真正想知道的是如何使用javascript更改“图层混合模式”,而不是“刷子模式”(如正常,多重,清晰等等)。我似乎无法找到一些资源来控制画笔模式。

希望你们能帮助我,并在这件事上说清楚。

2 个答案:

答案 0 :(得分:2)

可能的是,这是我拼凑的一个片段,它通过创建动作并执行来起作用。 (通常无法通过常规操作更改笔刷模式,但在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 );

答案 1 :(得分:0)

我遇到了相同的限制,并使用AutoHotkey来解决这些限制。

此脚本将Shift + e设置为Alt + Shift + r(清除画笔模式),将Shift + r设置为Alt + Shift + n(常规画笔模式)。

下载AutoHotkey,将以下脚本另存为.ahk,然后双击它。

#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

如果希望它在启动时运行,可以将其保存到Windows启动文件夹中:

C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\brushBlendModes.ahk