🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.photoshop.scripting
Article #414

Re: Script to check for presence of a layer mask

#414
From: Paul_R
Date: Fri, 23 Jan 2009 19:45
6 lines
1864 bytes
See if this will do....



 
for(var a =0;a<activeDocument.artLayers.length;a++){  activeDocument.activeLayer = activeDocument.artLayers[a];  if(hasLayerMask()){  	selectMask();  	applyMask();  	}  }  function hasLayerMask() {      var ref = new ActionReference();      ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));      var desc = executeActionGet(ref);      return desc.hasKey(charIDToTypeID("UsrM"));  }  function applyMask() {      var desc164 = new ActionDescriptor();          var ref66 = new ActionReference();          ref66.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );      desc164.putReference( charIDToTypeID('null'), ref66 );      desc164.putBoolean( charIDToTypeID('Aply'), true );      executeAction( charIDToTypeID('Dlt '), desc164, DialogModes.NO );  };  function selectMask() {      var desc184 = new ActionDescriptor();          var ref84 = new ActionReference();          ref84.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('Msk ') );      desc184.putReference( charIDToTypeID('null'), ref84 );      desc184.putBoolean( charIDToTypeID('MkVs'), false );      executeAction( charIDToTypeID('slct'), desc184, DialogModes.NO );  }; 
Technical Details
Message-ID: <59b7a3d8.0@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
References: <59b7a3d8.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f5839,da4af0c0c71df769
X-Google-Attributes: gidf5839,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Paul_R@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.photoshop.scripting
Subject: Re: Script to check for presence of a layer mask
Message-ID: <59b7a3d8.0@webcrossing.la2eafNXanI>
Date: Fri, 23 Jan 2009 11:45:41 -0800
References: <59b7a3d8.-1@webcrossing.la2eafNXanI>
Lines: 36
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit