Determine if hidden layers exist


i building script cleanse photoshop documents, , 1 of options including remove hidden layers. there no direct command (or none have seen), used chunk of code scriptlistener perform 'delete hidden layers' command.

 

i want enable option if there layers hidden, i'm wondering if there simple way determine if layers hidden in document (aside looping through of layers). or, if there's way determine if 'delete hidden layers' command enabled or not, since enabled when there hidden layers.

i bung code between try catch block (but i'm lazy )

if did want check should fast...

 

 

alert(hashiddenlayers());  function hashiddenlayers(){     var ref = new actionreference();     ref.putenumerated( charidtotypeid('dcmn'), charidtotypeid('ordn'), charidtotypeid('trgt') );     var count = executeactionget(ref).getinteger(charidtotypeid('nmbl')) +1;  try{     activedocument.backgroundlayer; var = 0; }catch(e){ var = 1; };    for(i;i<count;i++){         if(i == 0) continue;         ref = new actionreference();          ref.putindex( charidtotypeid( 'lyr ' ), );         var desc = executeactionget(ref);         var layername = desc.getstring(charidtotypeid( 'nm  ' ));         var id = desc.getinteger(stringidtotypeid( 'layerid' ));         if(layername.match(/^<\/layer group/) ) continue;         if(!desc.getboolean(charidtotypeid( "vsbl" ))) return true;    };  return false; }; 


More discussions in Photoshop Scripting


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account