Skip to main content
Known Participant
January 6, 2021
Answered

Could You Select All Layers Sequentially

  • January 6, 2021
  • 2 replies
  • 21919 views

I Wish Select All Layer One By One Sequentially. Like 1,2,3,4 so on. 

Thanks in Advance

Correct answer Chuck Uebele

I want to rename the layer left to right form. I have show the image. check it


Your first screen shot showed that you wanted the artboard numbered top to bottom then left to right, which the previous script that I posted did. You're second screen shot shows left to right then top to bottom. So this script does that:

 

#target photoshop
var doc = activeDocument;
var artArray = [];
var count = 0;
for(var i=0;i<doc.layers.length;i++){
    doc.activeLayer = doc.layers[i];
    if(isArtBoard ()){
        var dimArt = getArtboardDimensions ()
        artArray.push([dimArt[0],dimArt[1],doc.activeLayer])
        count++
        }
    }

artArray.sort(function(a,b){return (a[1]-b[1]) || (a[0]-b[0])});

for (i=0;i<artArray.length;i++){
    artArray[i][2].name = 'Artboard ' + (i+1);
    }

function isArtBoard()
{
    var ref = new ActionReference();
    ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    return executeActionGet(ref).getBoolean(stringIDToTypeID("artboardEnabled"));
}; // end of isArtBoard()

function getArtboardDimensions()
{
    var ref = new ActionReference();
    ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID("artboard")).getObjectValue(stringIDToTypeID("artboardRect"));
    var left = desc.getDouble(stringIDToTypeID("left"));
    var top = desc.getDouble(stringIDToTypeID("top"));
    return [left, top]
}; // end of getArtboardDimensions()

 

2 replies

PECourtejoie
Community Expert
Community Expert
September 10, 2021

Hello, the merging of the threads made it very difficult to follow.

@MXKS could you maybe post the explanation in your native language?

 

The way I understand, you would like to have a script that would 1) name layers from a given order 2) change the layers position from top to bottom?

Stephen Marsh
Community Expert
Community Expert
September 10, 2021
quote

Hello, the merging of the threads made it very difficult to follow.

@MXKS could you maybe post the explanation in your native language?

 

The way I understand, you would like to have a script that would 1) name layers from a given order 2) change the layers position from top to bottom?


By @PECourtejoie

 

 

Truth be told, it was a dog's breakfast before then, perhaps even from the start? This is a serial issue with almost every topic created by MXKS. For what it is worth, my vote would be to press the reset button (lock the thread and start again).

 

I also agree that the online translator used by the OP is not helping, posting in their native language and stating in English which language this is would help interested parties to use their own preferred translation services to read the question. That being said, translation is only part of the problem. Clear concise step by step points stating the objective and steps, with screenshots with useful annotations would surely help from the very start. 

 

MXKSAuthor
Known Participant
September 10, 2021

For Better Under I posted the image @Stephen Marsh

 

Step 1:- I have 4Layers Of Squre.

Step 2:- I want to Select top to bottom like second image in scripts

 

Here is script >..

Sep 09, 2021

 

 

Ro Hackett
Inspiring
January 6, 2021

You can select multiple individual layers by holding the CTRL key and clicking each layer... ? ...

but not really sure what you mean? 🤔 🤔😮

Stephen Marsh
Community Expert
Community Expert
January 7, 2021

Ro Hackett It's a scripting question.

 

Kailash0D4D what should happen after Layer 1 is selected, before Layer 2 is selected?

 

There are actually two layers per "visual layer set", one being a color fill layer and one a text layer. The layer index order is not sequential. All of the fill layers come first, then the text layers (not fill then text, fill then text etc).

 

So which exact layer should be selected "sequentually"?

MXKSAuthor
Known Participant
September 10, 2021

You do not seem to understand that the script is design to rename layer based on their position over the documents canvas.  If I change the Sorting routine and select only four of the five  image layers the layers may be renamed the way you want.  It depends on which Image layers I select. However if a Select all five image layers two  of the five will be renamed like you want the other three will not,  The script renamed the selected layers relative to their position  over the document canvas. The Five image would be renames like this.

The  order my script populated the Collage was like this.

Here populated with Image Name stamping  and text and Image layer style added using my scripts available options.

 

 

 


Yes I want this top to bottom select layer @JJMack