revnart
Power User
- Messages
- 362
- Likes
- 327
Hi, maybe I'm not the only one, whit this problem. When i have layers like this:
and go to Layer > Arrange > Reverse (I have selected all layers before that step )
I get error:
The only solution is to make one layer at top of the layers stack, then one in the bottom of layers stack, select layers between those two and it works without problems
I was a little frustrated so I created small script that helps reversing order of layers. No rocket science, probably can be done better, more efficient and so on - but for me is enough, posting it here beceuse someone may find it useful.
One note only: it will not work with groups
result:
and go to Layer > Arrange > Reverse (I have selected all layers before that step )
I get error:
The only solution is to make one layer at top of the layers stack, then one in the bottom of layers stack, select layers between those two and it works without problems
I was a little frustrated so I created small script that helps reversing order of layers. No rocket science, probably can be done better, more efficient and so on - but for me is enough, posting it here beceuse someone may find it useful.
One note only: it will not work with groups
JavaScript:
var layers = app.activeDocument.artLayers.length;
for (var i = 1; i < app.activeDocument.artLayers.length; i++)
{
// SELECT MOST BOTTOM LAYER
var idslct = charIDToTypeID( "slct" );
var desc16 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref16 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idBack = charIDToTypeID( "Back" );
ref16.putEnumerated( idLyr, idOrdn, idBack );
desc16.putReference( idnull, ref16 );
var idMkVs = charIDToTypeID( "MkVs" );
desc16.putBoolean( idMkVs, false );
var idLyrI = charIDToTypeID( "LyrI" );
var list12 = new ActionList();
list12.putInteger( 3 );
desc16.putList( idLyrI, list12 );
executeAction( idslct, desc16, DialogModes.NO );
// MOVE ONE LAYER UP
for (var x = 0; x < app.activeDocument.artLayers.length - i ; x++) {
var idmove = charIDToTypeID( "move" );
var desc67 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref41 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref41.putEnumerated( idLyr, idOrdn, idTrgt );
desc67.putReference( idnull, ref41 );
var idT = charIDToTypeID( "T " );
var ref42 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idNxt = charIDToTypeID( "Nxt " );
ref42.putEnumerated( idLyr, idOrdn, idNxt );
desc67.putReference( idT, ref42 );
executeAction( idmove, desc67, DialogModes.NO );
}}
result: