• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Could You Select All Layers Sequentially

Participant ,
Jan 06, 2021 Jan 06, 2021

Copy link to clipboard

Copied

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

Thanks in Advance

Capture.JPG

TOPICS
Actions and scripting

Views

8.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 3 Correct answers

Community Expert , Jan 10, 2021 Jan 10, 2021

Presuming that a layer has a unique name (otherwise the first layer with the name will be targeted, which may not be the one you require):

 

 

var selectLayer1 = app.activeDocument.artLayers.getByName("Layer 1");
app.activeDocument.activeLayer = selectLayer1;

 

 

or

 

 

app.activeDocument.activeLayer = app.activeDocument.layers["Layer 1"];

 

 

 

The layers collection can also be used, it starts the indexing at zero, so the 8th layer from the top would be #7:

 

 

var selectLayer = app.activeDocum
...

Votes

Translate

Translate
People's Champ , May 04, 2021 May 04, 2021

In your script, right after the line

var ids = getLayersIDs (); // getting ids of selected layers

 

paste this code:

ids.sort(cmp);
function cmp(a, b)
    {
    try {
        var r = new ActionReference();
        r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("bounds"));
        r.putIdentifier(stringIDToTypeID("layer"), a);
        var b1 = executeActionGet(r).getObjectValue(stringIDToTypeID("bounds"));

        var l1 = b1.getUnitDoubleValue(stringIDToTypeID("left"));

       
...

Votes

Translate

Translate
Community Expert , May 06, 2021 May 06, 2021

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],dimA
...

Votes

Translate

Translate
Adobe
Participant ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

No , I have no tried ...

I have changed for (var i = ids.length;  i  >=  0;  i--)

But illigal Argument error @JJMack 

function selectById(id)
{
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putIdentifier(charIDToTypeID('Lyr '), id); //Getting a error
desc1.putReference(charIDToTypeID('null'), ref1);
executeAction(charIDToTypeID('slct'), desc1, DialogModes.NO);
};

  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

I do not javascript I just hack at it. It may need a -1

try

for (var i = ids.length-1;  i  >=  0;  i--)

for (var i = ids.length-1; i > 0;  i--)

and

for (var i = ids.length-1 ; 0 <= i; i--)

see if either work

try to understand what is going on  computers count from 0 to N. So often when  processing  you  need to add in a  -1 or +1 into your  routine.

 

Setting i to xxx.length set the index to one slot past N for the length of the array is N-1 for computers count from 0 one less then one.

 

The script you are using looks like it also sort layer ID.   I do not know why that was done for,   Layer position in the layer stack can be changed.  I do not believe the will change a layaer's ID I think ir would not the later ID is unique and does not change,  However a layers stack position can be be changed.  You may not want to process the layers in ID sort order you may want to process the layers in stack order.

 

I feel you found this script somewhere and you do now know what it does. It look like it is renaming layers in the layer ID sort order.  I do not know why that would be useful for someone.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

Same thing, Didn't work for me

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

Please help me I have tired lot of times, So sad

@r-bin , @Kukurykus , @jazz-y , @Stephen_A_Marsh 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

it seems that you are not even trying to understand how and why your code works. So sad.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

I am trying lots of time but didnot work..

return l2 - l1;

Position is good but It's right to left

I want left to right

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

It seems that the order of renaming the layers in the document is different, depending its initial position.

 

I have no way to check your code right now.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

Please modify the code @jazz-y 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

I am afraid that from your description I do not fully understand the problem that needs to be solved.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

For Better Understand I have posted the image

sg1.jpg

sg2.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

We do not know how you expect this script to work. Right now the script sorts the layer bounds and renames the layers by their bounds order bottom left  to top right.

 

My collage populating script populated this five images  collage in the following order Top Left image, Top Right image, Bottom Left image,  Bottom Right image, Center center image.  You can see the layer are 1,2,3,4,5 bottom of the stack to the top of the layer stack.  Your script rename the bottom left image layer 1, The top left image layer 2,  The Center center image Layer 3, the bottom right image layer 4 and the top right in layer 5. 

 

That is what the script was programed to do.  If you want some other naming convention you need to design the process. The things is when layers overlap  the stacking position is as important then the bounds.  That is why my center center image is  topmost in the layer stack.

 

Your script has nothing I want. Who Programmed it for what?

 

Capture.jpg

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

Yes I have marked red please check it @JJMack 

top to button only

cp.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

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.

Capture.jpg

The  order my script populated the Collage was like this.

Capture.jpg

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

image.png

 

 

 

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 10, 2021 Sep 10, 2021

Copy link to clipboard

Copied

Yes I want this top to bottom select layer @JJMack 

c2.jpg

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

I have sent new image, please see the image below

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Some changes are not the problem, like explaining everything at beginning to avoid them 😉

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

You'll find it out once after entire job from your side will be done 😛 or you'll finnish like me over:

I want to move the file in active document

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

You were asked:

quote

Confirm or refute the sequence, but only reasonably, and not like this: "i want ...".

 

Then you replied:

quote

Yes, I want this


And now you act like nor the question was asked, nor you answered to 😄

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Yes but some change its not a problem

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

If you want that script to be modified to operate differently you should make the modification yourself.  If you want a template like you show in the order that you show and not do any Photoshop scripting.  You need to find a Collage populating script the its easy to create templates for that will be populated in the order you desire.   You just need to create a simple collage template. 

 

My free Photoshop Photo Collage and Mockup Toolkit's  collage script would have no problem populating a template like you want.  You just need need to create the template psd/psdt  then point a collage populating script to the template and the folder your image are in. The image will be populated in File Name sort order into the collage template Image areas in the Image Area order you created in the template.  You control the Image  file processing order via file name and collage area by Image area alpha channel image numbers the  Image 1 to Image N.  N has a Photoshop limit of 53 alpha channes. So a collage template has a limit of 53 Images the cans be populated and the Image numbers need to be sequential 1,2,3,4,... there cans be no gaps if there  is no 3 only two image will be populated.

 

The template for your College would look like this:

image.png

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Yes This is perfect, But which script to do, Please share the name of script. Is that possible to modify the script as per as your script..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Sure knock yourself out look at the script code in my script and modify that script with code in like my scripts have.  IMO you should read the help in my package to understand how my scripts work and learn all they can do.

 

Im my Package the followind scripts can be used to populate a collage template like you want.

  1. TestCollageTemplate.jsx - Used to test a Photo Collage Template while you are making it with Photoshop.
  2. InteractivePopulateCollage.jsx - Used to interactively populate Any Photo Collage template. Offers most user control inserting pictures and text.
  3. PopulateCollageTemplate.jsx - Used to Automatically populate a Photo Collage template and leave the populated copy open in Photoshop.
  4. BatchMultiImageCollage.jsx - Used to Automatically Batch Populate Any Photo Collage template with images in a source image folder. Easier to use than the interactive script. Saved collages can be tweaked.
JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines