Hi all, Is there solution for Brush's spacing (check box) setting avoid reset when script set brush's hardness. # I mean I just want to change hardness. But I'm digging hole deeper and deeper. When I tried to record to change Brush's Hardness change by ScriptListner, it seems not recording. Brush size was recorded fine. The code was re-usable. I found JJMack​'s code at Is it possible to script brush opacity? and testing. But if Spacing checkbox was OFF, it change to checkbox ON and 25% as default setting. Is there way to get and set checkbox of Spacing? Or just change Hardness without spacing reset? Following is test code. If Spacing checkbox is ON, it works as expected as no change. If Spacing checkbox is OFF, Spacing setting gets reset. Test code var _r1 = getBrushFeatures (); $.writeln("_r1 = ", _r1); setBrushFeatures (_r1[0],_r1[1],_r1[2],_r1[3],_r1[4],_r1[5],_r1[6]); // test: set same value //setBrushFeatures (1,2,3,4,5,true,false); // test: overwrite var _r2 = getBrushFeatures (); $.writeln("_r2 = ", _r2); $.writeln('debugger break'); function getBrushFeatures (){ //A Brush tool must be the current tool if (!app.toolSupportsBrushes(app.currentTool)) selectBrush(); //CC 2014 var ref = new ActionReference(); ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); var appDesc = executeActionGet(ref); var toolDesc = appDesc.getObjectValue(stringIDToTypeID('currentToolOptions')); var brushDesc = toolDesc.getObjectValue(stringIDToTypeID('brush')); var currDiameter = brushDesc.getDouble(stringIDToTypeID('diameter')); var currHardness = brushDesc.getDouble(stringIDToTypeID('hardness')); var currAngle = brushDesc.getDouble(stringIDToTypeID('angle')); var currRoundness = brushDesc.getDouble(stringIDToTypeID('roundness')); var currSpacing = brushDesc.getDouble(stringIDToTypeID('spacing')); var currFlipy = brushDesc.getBoolean(stringIDToTypeID('flipY')); var currFlipx = brushDesc.getBoolean(stringIDToTypeID('flipX')); var currentFeatures = new Array( currDiameter, currHardness, currAngle, currRoundness, currSpacing, currFlipy, currFlipx ); return currentFeatures } function setBrushFeatures (Diameter,Hardness,Angle,Roundness,Spacing,Flipy,Flipx) { var desc = new ActionDescriptor(); var ref = new ActionReference(); ref.putEnumerated( charIDToTypeID( "Brsh" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) ); desc.putReference( charIDToTypeID( "null" ), ref ); var desc1 = new ActionDescriptor(); desc1.putDouble(stringIDToTypeID('diameter'), Diameter); desc1.putDouble(stringIDToTypeID('hardness'), Hardness); desc1.putDouble(stringIDToTypeID('angle'), Angle); desc1.putDouble(stringIDToTypeID('roundness'), Roundness); // Commeting out next line will reset: Checkbox ON 25% as default desc1.putUnitDouble( stringIDToTypeID('spacing'), charIDToTypeID('#Prc'), Spacing); desc1.putBoolean(stringIDToTypeID('flipY'), Flipy); desc1.putBoolean(stringIDToTypeID('flipX'), Flipx); desc.putObject( stringIDToTypeID('to'), charIDToTypeID( "Brsh" ), desc1 ); executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO ); } Thank you, Naoki
... View more