Brush pressure control, CS6

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

Korontari

Brush pressure control, CS6

Post by Korontari »

Hello all,

I am much more an artist rather than programmer and I have a very basic PS scripting knowledge. So here is the problem I can't solve without help from PS-scripting gurus.

I would like to be able to change the pressure control for the opacity and shape of a currently selected brush with a hot key. Here is an illustration of what controls I mean:



What I want in the end is a hotkey for switching between "Control:Pen Pressure" and "Control:Off" for Opacity Jitter and another hotkey for the same action for Size Jitter. All this applies for currently selected brush only - I do not need to change the brush preset.

As far as I understand there is no ability to change brush setting within documented API but maybe there is some workaround with undocumented commands? I would appreciate any help or information about that.

Thank you!

Pavel.

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

Brush pressure control, CS6

Post by Mike Hale »

The only way I know for a script to change those types of brush options is with brush presets.

The tool options can be read by a script so it can determine the settings of the current options. But I have never been able to find a way to set an individual option like brush pressure.

A script can change some brush tips options like size, hardness, etc. But even then that will only work with what is called a 'computed' brush. That is a brush like one of the round brushes. 'Sampled' brushes like spatter, chalk, etc. can not be changed at all by a script without using brush presets.

Finally, the only way to have a 'hot key' with javascript in Photoshop is to record the script in an Action and give that Action a keyboard shortcut.
Korontari

Brush pressure control, CS6

Post by Korontari »

Thank you for your reply, Mike.

The last question I have in mind. Is it possible to change brush presets with the script?
It would probably worked fine for me if the preset itself is being changed with a hotkey the way I described above.
Mike Hale

Brush pressure control, CS6

Post by Mike Hale »

Yes, here is how to select a tool preset.
Code: Select all    var desc = new ActionDescriptor();
        var ref = new ActionReference();
        ref.putName( stringIDToTypeID('toolPreset'), "mike" );
    desc.putReference( charIDToTypeID('null'), ref );
    executeAction( charIDToTypeID('slct'), desc, DialogModes.NO );