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

Set spacing for brush

Community Beginner ,
Apr 16, 2016 Apr 16, 2016

Copy link to clipboard

Copied

HI, I want to set hardness for a brush, but when I use a function to do so, the spacing and diameter is set to 25 automatically. So I use this function to set hardness, spacing and  diameter:

  function setBrushFeatures(Diameter,Hardness,Spacing) { 

  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 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('spacing'), Spacing); 

 

  var desc5 = new ActionDescriptor(); 

  var idnull = charIDToTypeID( "null" ); 

  var ref3 = new ActionReference(); 

  var idBrsh = charIDToTypeID( "Brsh" ); 

  var idOrdn = charIDToTypeID( "Ordn" ); 

  var idTrgt = charIDToTypeID( "Trgt" ); 

  ref3.putEnumerated( idBrsh, idOrdn, idTrgt ); 

  desc5.putReference( idnull, ref3 ); 

 

   desc5.putObject(charIDToTypeID('T   '), charIDToTypeID('Brsh'), desc1); 

   executeAction(charIDToTypeID('setd'), desc5, DialogModes.NO); 

}

This works but the spacing is not applied, what am I missing?

Cheers

Matthias

TOPICS
Actions and scripting

Views

700

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

correct answers 1 Correct answer

Guide , Apr 16, 2016 Apr 16, 2016

setBrushFeatures(50,50,50);

function setBrushFeatures(Diameter,Hardness,Spacing) { 

  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 desc = new ActionDescriptor();

  var ref = new ActionReference();

  ref.putEnumerated( cha

...

Votes

Translate

Translate
Adobe
Guide ,
Apr 16, 2016 Apr 16, 2016

Copy link to clipboard

Copied

setBrushFeatures(50,50,50);

function setBrushFeatures(Diameter,Hardness,Spacing) { 

  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 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.putUnitDouble( stringIDToTypeID('spacing'), charIDToTypeID('#Prc'), Spacing);

  var desc5 = new ActionDescriptor();

  var idnull = charIDToTypeID( "null" );

  var ref3 = new ActionReference();

  var idBrsh = charIDToTypeID( "Brsh" );

  var idOrdn = charIDToTypeID( "Ordn" );

  var idTrgt = charIDToTypeID( "Trgt" );

  ref3.putEnumerated( idBrsh, idOrdn, idTrgt );

  desc5.putReference( idnull, ref3 );

  desc5.putObject(charIDToTypeID('T   '), charIDToTypeID('Brsh'), desc1);

  executeAction(charIDToTypeID('setd'), desc5, 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 ,
Apr 17, 2016 Apr 17, 2016

Copy link to clipboard

Copied

Ah cool, thx, How did you found out that #Prc is needed?

Matthias

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 ,
Apr 17, 2016 Apr 17, 2016

Copy link to clipboard

Copied

Just used scriptListener after altering the spacing.

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 ,
Apr 17, 2016 Apr 17, 2016

Copy link to clipboard

Copied

ok thx, is there a script listener for photoshop CC 2015 also? can't find it.

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 ,
Apr 17, 2016 Apr 17, 2016

Copy link to clipboard

Copied

You should be able to download it from here:-

Adobe Photoshop Scripting | Adobe Developer Connection

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 ,
Apr 17, 2016 Apr 17, 2016

Copy link to clipboard

Copied

Yes, thank you. But where to put it, in which folder, there is no folder for Plugins or Utilities.

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 ,
Apr 18, 2016 Apr 18, 2016

Copy link to clipboard

Copied

It goes in the Applications Plug-ins\Automate folder if they do not exist create the folders.

On my Windows Photoshop 64 bit it is in:

C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Plug-ins\Automate

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
Explorer ,
Jun 28, 2016 Jun 28, 2016

Copy link to clipboard

Copied

Hi SuperMerlin,

With me, Script listener doesn't output anything when adjusting any brush value. Would you possibly know the reason?

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 ,
Jun 28, 2016 Jun 28, 2016

Copy link to clipboard

Copied

The simple answer is ScriptListener does not record everything.

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
Explorer ,
Jun 28, 2016 Jun 28, 2016

Copy link to clipboard

Copied

LATEST

Oh, okay, but I thought that the spacing it would show as you said "Just used scriptListener after altering the spacing."?

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