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

Get a brush index

Community Beginner ,
Apr 26, 2018 Apr 26, 2018

Copy link to clipboard

Copied

Hello everyone,

I am trying to write a script that would loop throug a set of brushes, I know that there are shortcuts for "next brush" and "previous brush" but it always stops once it gets to the end of the brush set or to the beginning. The problem that I ran into was that I am able to select a brush by its ID using the scrpt listener however I can't modify the function to get the brush ID.

Here is the function SelectBrushByID:

function selectBrushByID (id) {

   

    var idslct = charIDToTypeID( "slct" );

    var desc6 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

    var ref4 = new ActionReference();

    var idBrsh = charIDToTypeID( "Brsh" );

    ref4.putIndex( idBrsh, id );

    desc6.putReference( idnull, ref4 );

     executeAction( idslct, desc6, DialogModes.NO );

  

    };

Here is a function GetBrushName:

function getName() {   

 

  var appAR = new ActionReference();   

  appAR.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );   

  var app = executeActionGet(appAR);   

   

  var brush = app.getObjectValue(stringIDToTypeID('currentToolOptions')).getObjectValue(stringIDToTypeID('brush'));   

    return brush.getString(stringIDToTypeID('name')) ;  

   }

   

};

What I have been trying to get was a getIndex function, I thought it would be very similar to the getName one just by modifying the last row to something like return brush.getInteger(StringIDToTypeID('idx')); but that doesn't work. I have been trying to find the correct name or type of the value id or index but without any luck. I believe that it is simple but I have very little experience with writing my own AM script, so I would greately appreaciate any help.

Thank you so much in advance and have a nice day.

Sharka

TOPICS
Actions and scripting

Views

328

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 ,
Apr 26, 2018 Apr 26, 2018

Copy link to clipboard

Copied

LATEST

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