Push all selected layers EXCEPT GROUPS into an array
hi, i've been googling couple of hours can't seem find solution...
i need script affect _selected_ layers in psd. works fine when there no groups involved in selection, want achieve user able select mix of layers , groups, , script push layers (including ones in groups, if individual layers not selected, when group collapsed example) array. i've been looking xtools scripts network security tight on work computer unable install rely on libraries & dependencies (so have write myself unfortunately).please help!
at moment part of script relevant:
#target photoshop /* // save current preferences var startrulerunits = app.preferences.rulerunits var starttypeunits = app.preferences.typeunits var startdisplaydialogs = app.displaydialogs */ app.preferences.rulerunits = units.pixels app.preferences.typeunits = typeunits.pixels // var doc = app.activedocument; var currentlayer = activedocument.activelayer; // array of selected layers within group function getselectedlayers(){ var idgrp = stringidtotypeid( "grouplayersevent" ); var descgrp = new actiondescriptor(); var refgrp = new actionreference(); refgrp.putenumerated(charidtotypeid( "lyr " ),charidtotypeid( "ordn" ),charidtotypeid( "trgt" )); descgrp.putreference(charidtotypeid( "null" ), refgrp ); executeaction( idgrp, descgrp, dialogmodes.all ); var resultlayers=new array(); var = app.activedocument.activelayer.layers.length; // establish in advance function doesn't check every time (var ix=0;ix<a;ix++){ alert(a[ix].name); // if (a[ix].typename != "layerset") { resultlayers.push(a[ix]) // } } var id8 = charidtotypeid( "slct" ); var desc5 = new actiondescriptor(); var id9 = charidtotypeid( "null" ); var ref2 = new actionreference(); var id10 = charidtotypeid( "hsts" ); var id11 = charidtotypeid( "ordn" ); var id12 = charidtotypeid( "prvs" ); ref2.putenumerated( id10, id11, id12 ); desc5.putreference( id9, ref2 ); executeaction( id8, desc5, dialogmodes.no); return resultlayers; } var layerstouse = getselectedlayers(); // loop through selected text layers (e=0; e<layerstouse.length; e++) { currentlayer = layerstouse[e]; // stuff each layer }
not wanted, can't select many layers script, 1 or group of layers after has create new layer on selected layer or in selected group, maybe can play needs make somehow working selecting more 1 layer or/and group. check post fri nov 18, 2016 5:45 pm in there: creating , moving artlayer inside "active" layerset - page 3 - ps-scripts.com
More discussions in Photoshop Scripting
adobe
Comments
Post a Comment