The following batchPlay code sets Brush opacity:
require('photoshop').action.batchPlay([
//Set brush opacity to 100%
{ "_obj": "set","_target": { "_ref": "paintbrushTool" }, "to": { "_obj": "currentToolOptions", "opacity": 100}, "_options": {"dialogOptions": "dontDisplay" }},
], {"synchronousExecution": false, "modalBehavior": "wait"});
However, on Windows, if any of the stylus-specific options on the Options bar (use pressure for size, use pressure for opacity, or enable airbrush) are toggled to “On,” they will toggle to “Off” when this code executes. It also happens when using batchPlay to change the blend mode of the brush. I had another customer who said just the opposite happened. For him, they toggled “On,” though I’ve not observed that.
I’ve also noticed the Burn and Dodge tools are similarly affected. Changing options in the Options bar with batchPlay toggles the stylus-specific settings to “Off.”
That doesn’t seem right. Ideally it would be possible to change just one or two things in the Options bar without affecting these stylus settings.