Copy link to clipboard
Copied
I Wish Select All Layer One By One Sequentially. Like 1,2,3,4 so on.
Thanks in Advance
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
...
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"));
...
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
...
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);
};
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.
Copy link to clipboard
Copied
Same thing, Didn't work for me
Copy link to clipboard
Copied
Please help me I have tired lot of times, So sad
Copy link to clipboard
Copied
it seems that you are not even trying to understand how and why your code works. So sad.
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
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.
Copy link to clipboard
Copied
Please modify the code @jazz-y
Copy link to clipboard
Copied
I am afraid that from your description I do not fully understand the problem that needs to be solved.
Copy link to clipboard
Copied
For Better Understand I have posted the image
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?
Copy link to clipboard
Copied
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.
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.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Some changes are not the problem, like explaining everything at beginning to avoid them 😉
Copy link to clipboard
Copied
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:
Copy link to clipboard
Copied
You were asked:
Confirm or refute the sequence, but only reasonably, and not like this: "i want ...".
Then you replied:
Yes, I want this
And now you act like nor the question was asked, nor you answered to 😄
Copy link to clipboard
Copied
Yes but some change its not a problem
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:
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..
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.
Copy link to clipboard
Copied
Copy link to clipboard
Copied