Send backwards
hi. how code in javascript send layer backwards, in layer > arrange > send backward? it#s part of simple script has 2 layers , need arrange them new layer moves top underneath other layer.
i've got following, i'm after cleaner
// =======================================================
var id122 = charidtotypeid( "move" );
var desc28 = new actiondescriptor();
var id123 = charidtotypeid( "null" );
var ref10 = new actionreference();
var id124 = charidtotypeid( "lyr " );
var id125 = charidtotypeid( "ordn" );
var id126 = charidtotypeid( "trgt" );
ref10.putenumerated( id124, id125, id126 );
desc28.putreference( id123, ref10 );
var id127 = charidtotypeid( "t " );
var ref11 = new actionreference();
var id128 = charidtotypeid( "lyr " );
var id129 = charidtotypeid( "ordn" );
var id130 = charidtotypeid( "prvs" );
ref11.putenumerated( id128, id129, id130 );
desc28.putreference( id127, ref11 );
executeaction( id122, desc28, dialogmodes.no );
cheers
you create function ie:
movelayerupordown("down"); // "up" or "down" function movelayerupordown(direction) { switch(direction.tolowercase()){ case 'up' : direction = 'nxt '; break; case 'down' : direction = 'prvs'; break; default : direction = 'prvs'; break; } var desc = new actiondescriptor(); var ref = new actionreference(); ref.putenumerated(charidtotypeid('lyr '),charidtotypeid('ordn'),charidtotypeid('trgt') ); desc.putreference(charidtotypeid('null'), ref ); var ref2 = new actionreference(); ref2.putenumerated(charidtotypeid('lyr '),charidtotypeid('ordn'),charidtotypeid(direction) ); try{ desc.putreference(charidtotypeid('t '), ref2 ); executeaction(charidtotypeid('move'), desc, dialogmodes.no ); }catch(e){} }
More discussions in Photoshop Scripting
adobe
Comments
Post a Comment