PS script - broken AM code - layer effects

  • 2
  • Problem
  • Updated 1 year ago
I have 3 and more layer effects. All are stroke. I want remove third stroke with AM code. This is recorded by script listener. But this always remove first effect of same type. No matter which index I choose. Same action reference works good for show/hide layer Fx. Removing just don't works.

var idHd = charIDToTypeID( "Hd  " );
    var desc260 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var list17 = new ActionList();
            var ref127 = new ActionReference();
            var idFrFX = charIDToTypeID( "FrFX" );
            ref127.putIndex( idFrFX, 3 );
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref127.putEnumerated( idLyr, idOrdn, idTrgt );
        list17.putReference( ref127 );
    desc260.putList( idnull, list17 );
executeAction( idHd, desc260, DialogModes.NO );
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 763 Posts
  • 157 Reply Likes

Posted 1 year ago

  • 2
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 763 Posts
  • 157 Reply Likes
Code for removing effect. Code above is for hiding
var iddsfx = charIDToTypeID( "dsfx" );
    var desc251 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref122 = new ActionReference();
        var idFrFX = charIDToTypeID( "FrFX" );
        ref122.putIndex( idFrFX, 3 );
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref122.putEnumerated( idLyr, idOrdn, idTrgt );
    desc251.putReference( idnull, ref122 );
executeAction( iddsfx, desc251, DialogModes.NO );