• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Revisiting Scripting after a long break: Before I start - Brush Pattern Definition

Community Beginner ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

As above, I have vbs background and have done a lot of scripting about 10 years ago. Of course things have changed a lot but its become pretty hard with enumerated 4 byte etc making code far less logical or readable.

Loved that it was easy stem based language before...and in the meantime have done a lot of python so it seems to have gone backwards

 

Anyway

 

I simply want to iterate a number of layers that contain brush samples etc which all still seems to work the same way eg

  • each layer will be slightly resized to comply with target brush size

but Im having trouble with the following

  • each layer will then define a new named brush
  • following code will call the named brush

 

I searched the script reference and could see no mention of the equivalent menu items ie define brush etc so my question is, how is this now best and most elegantly accomplished? 

 

Cheers

TOPICS
Actions and scripting , Windows

Views

198

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

I guess @c.pfaffenbichler @jazz-y @r-bin @Stephen_A_Marsh haven't seen this thread so far.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

I don’t quite understand the process, please post screenshots to illustrate. 

 

And I can only provide advice on Photoshop Scripting in JavaScript, being the platform-independent one of the three options. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 24, 2022 Aug 24, 2022

Copy link to clipboard

Copied

@c.pfaffenbichler Isnt python cross platform?

Appreciate your response...:-)

 

The main thing that Im having trouble with is taking a layer and converting it to custom brush, then accessing the brush in the script to programmatically place instances of that brush

 

Image_Engine_0-1661381752053.png

Excuse the pic...

so there will be user input to define an selection area

selection > layer (repeat 24 times)

 

CODE:

Loop through layers, converting each to a custom brush

the code then iterates through a grid ie X,Y and randomly loads each custom brush, apply transfomations eg mirror, flip and places it on to the target layer

 

The issues are the granular access to the brush stuff...I cant see it in the script docs

hth

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

@Image_Engine , install ScriptingListener plug-in it receives notifications about your actions in Photoshop and write them as a code on the desktop.

 

make("unique brush name");
function make(tilte) {
	var s2t = stringIDToTypeID;
	
	var descriptor = new ActionDescriptor();
	var reference = new ActionReference();
	var reference2 = new ActionReference();

	reference.putClass( s2t( "brush" ));
	descriptor.putReference( s2t( "target" ), reference );
	reference2.putProperty( s2t( "property" ), s2t( "selection" ));
	reference2.putEnumerated( s2t( "document" ), s2t( "ordinal" ), s2t( "targetEnum" ));
	descriptor.putReference( s2t( "using" ), reference2 );
	descriptor.putString( s2t( "name" ), tilte );
	executeAction( s2t( "make" ), descriptor, DialogModes.NO );
}
select('unique brush name');
function select(title) {
  var s2t = stringIDToTypeID;

  var descriptor = new ActionDescriptor();
  var reference = new ActionReference();

  reference.putName(s2t("brush"), title);
  descriptor.putReference(c2t("null"), reference);
  executeAction(s2t("select"), descriptor, DialogModes.NO);
}

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 24, 2022 Aug 24, 2022

Copy link to clipboard

Copied

Thanks again

Wow that is great..but many steps backwards for plain coders...it would take quite a while to learn that in any meaningful way.

So how its best to map that via com when (when I looked) the counterparts dont seem to be exposed?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 25, 2022 Aug 25, 2022

Copy link to clipboard

Copied

LATEST
executeAction( s2t( "make" )

seems like Im not getting it...have patched most of the errors...but this one being unavailable doesnt make sense.

The verbosity of vbs and even js to python is staggering and so difficult to read first up.

To do a basic single click of a brush currently selected at a particular coordinate...surely that cant be this hard.

 

I code remote scripts for Ableton live...which has a brilliant object model, cearly documented that makes this all seem so clumsy...sorry I dont mean to sound neg but the rest of the world has moved on...a decade ago...:-\

 

Cheers

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines