Loading a layer mask as Selection in Script
If you have a layer (Layer 1), that has a mask on it, if you look at the Channel list in Photoshop, you will see a channel named "Layer 1 Mask" of which you can load the selection using the "Load Selection..." dialog.
If a layer has a mask, even if the layer is the active layer, the mask is not a channel object in script. At least, it not exposed.
activeDocument.channels.length returns the number of component channels plus any alpha channels. In an RGB image with only the layer mask it returns 3.
activeDocument.channels.getByName("Layer 1 Mask") throws an error.
So I don't see a way to tell if a layer already has a mask or how to load that mask as a selection, apply or discrad the mask, or turn the mask off without using scriptlistner.
I personally am using C#, and I tried the following which worked:
curDoc.Selection.Load(curDoc.Channels["Blue] ,null, null);
But this doesn't:
curDoc.Selection.Load(curDoc.Channels["Layer 1 Mask"] ,null, null);
Any help would be appreciated ![]()
Carl
