Photoshop scripting get control position

389 views Asked by At

I would like to get a position of lets say a brush tool button inside photoshop. Is that possible with Photoshop scripting? Is it possible getting the value of a certain edit box (eg. brush size)?

enter image description here

Can it be done similar to this:

'PsJavaScriptExecutionMode Enums
Const psNeverShowDebugger = 1, psDebuggerOnError = 2, psBeforeRunning = 3

Dim appRef
Set appRef = CreateObject("Photoshop.Application")

Dim pos
pos = appRef.ControlPosition("paintbrushTool") //this is made up
1

There are 1 answers

1
Erin Finnegan On

You're asking two separate things:

  1. The value of a certain edit box (eg. brush size)

  2. The position of the Paint Brush tool itself. This is a UI question.

It's my understanding that for the first question, you're better off creating a brush present and scripting something to select that preset than you are trying to programmatically change the brush size, but I could be wrong.

This thread from the Adobe forums sounds relevant to what you're trying to accomplish, in regards to brushes and windows:

• get the current values

• adjust the value of the one property you want to change, like rotation

• set the values

Unfortunately I don't think the original poster was satisfied with the answers.

You might be better off making your own panel than trying to script the existing brush panel, but I could be wrong.

According to an old JavaScript Tools Guide for Adobe CC I found there is a ScriptUIBrush object:

ScriptUIBrush object A helper object that encapsulates the qualities of a brush used to paint fill into a path in a control. Create with the newBrush() method of the ScriptUIGraphics object.

I hope this helps!