2 Replies Latest reply on Jan 7, 2017 7:53 PM by j.krueger

    Delete spot channels toggled off

    j.krueger

      Is it possible to have a script delete all spot channels if their state is toggled off? The script would leave the composite RGB and all spot channels that were currently toggled on when the script was run.

        • 1. Re: Delete spot channels toggled off
          JavierAroche Level 3

          Hey j.krueger, this script should remove all spot channels toggled off.

           

          var doc = app.activeDocument;
          var docChannels = doc.channels;
          
          var desc = new ActionDescriptor();
          var list = new ActionList();
          
          for( var i = 0; i < docChannels.length; i++ ) {
               if( docChannels[i].kind == 'ChannelType.SPOTCOLOR' && !docChannels[i].visible ) {
                    var ref = new ActionReference();
                    ref.putName( charIDToTypeID( "Chnl" ), docChannels[i].name );
                    list.putReference( ref );
               }
          }
          
          desc.putList( charIDToTypeID( "null" ), list );
          executeAction( charIDToTypeID( "Dlt " ), desc, DialogModes.NO );
          
          • 2. Re: Delete spot channels toggled off
            j.krueger Level 1

            Thanks, Javier. The script worked exactly as needed.