OK. I seem to understand what you want. Try this function which can set 6 parameters, if given, without resetting any others.
What is Strength, Exposure and did not understand.
////////////////////////////////////////////////////////////////////////////////////////
function set_brush(sz, hd, sp, op, fl, sm)
{
try
{
var r = new ActionReference();
r.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "tool" ) );
r.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var ret = executeActionGet(r);
var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));
var tool = ret.getEnumerationType(stringIDToTypeID("tool"));
var brush = options.getObjectValue(stringIDToTypeID("brush"));
if (op != undefined) options.putInteger(stringIDToTypeID("opacity"), op);
if (fl != undefined) options.putInteger(stringIDToTypeID("flow"), fl);
if (sm != undefined && sp != 0)
{
options.putInteger( stringIDToTypeID ("smooth"), sm );
options.putDouble( stringIDToTypeID ("smoothingValue"), Math.round (sm/100*255) );
}
if (sz != undefined) brush.putUnitDouble( charIDToTypeID( "Dmtr" ), charIDToTypeID( "#Pxl" ), sz );
if (hd != undefined) brush.putUnitDouble( charIDToTypeID( "Hrdn" ), charIDToTypeID( "#Prc" ), hd );
if (sp == 0)
{
brush.putBoolean( stringIDToTypeID( "interfaceIconFrameDimmed" ), false);
}
else if (sp != undefined)
{
brush.putBoolean( stringIDToTypeID( "interfaceIconFrameDimmed" ), true);
brush.putUnitDouble( charIDToTypeID( "Spcn" ), charIDToTypeID( "#Prc" ), sp );
}
options.putObject( stringIDToTypeID( "brush" ), stringIDToTypeID( "null" ), brush );
var r = new ActionReference();
r.putClass( tool );
var desc = new ActionDescriptor();
desc.putReference( stringIDToTypeID( "null" ), r );
desc.putObject( stringIDToTypeID( "to" ), stringIDToTypeID( "null" ), options );
executeAction( stringIDToTypeID( "set" ), desc, DialogModes.NO );
}
catch (e) { alert(e) }
}
////////////////////////////////////////////////////////////////////////////////////////
Actually, I have CS6 and I can only change the parameters of the Brush object, and I can not change the opacity and other parameters due to an error in Photoshop.
With the locks, the question is open. If there is a lock, then the parameter through the script can not be changed. I found several identifiers that the photoshop understands:
stringIDToTypeID("smoothingLock")
stringIDToTypeID("brushTipDynamicsLock")
stringIDToTypeID("scatterDynamicsLock")
stringIDToTypeID("textureInteractionLock")
stringIDToTypeID("dualBrushLock")
stringIDToTypeID("colorDynamicsLock")
stringIDToTypeID("brushPoseLock")
stringIDToTypeID("noiseLock")
stringIDToTypeID("wetEdgesLock")
stringIDToTypeID("paintDynamicsLock")
stringIDToTypeID("repeatLock")
stringIDToTypeID("strokeStyleScaleLock")
stringIDToTypeID("protectTextureLock")
But I do not know where and how they can be applied so far.
p.s. How do you insert code with line numbering? 