Skip to main content
Inspiring
April 1, 2019
Answered

Removing Certain Channel Masks

  • April 1, 2019
  • 1 reply
  • 1285 views

I am looking for a way to loop through all the channel masks and only remove the ones with specific names.

Example:

I may have the following channel masks..

Mask1

Mask2

Mask3

I need the script to loop through all the channels and remove Mask1 , Mask2, Mask3 if found.

Any other masks with different names are to be ignored.

Has anyone got a s script or can help me create one to achieve this please.

This topic has been closed for replies.
Correct answer r-bin

What if I had this situation where I want to remove Mask1, mask2, Mask3

Would I need to run your suggestion 3 times or can it be all included in a single function


This code will remove the three channels: Mask1, Mask2 and Mask3.

1 reply

Legend
April 1, 2019

What do you mean when you say "channel masks"?

IanBarberAuthor
Inspiring
April 1, 2019

I should have maybe said a channel

For example, I make a selection and save the selection as Mask1 and it puts it in the Channels

Legend
April 1, 2019

OK. Then the easiest way

for (var i = 1; i <= 3; i++) try { activeDocument.channels.getByName("Mask"+i).remove(); } catch(e) {}