Page 1 of 1

Get layer comp index?

Posted: Sat Nov 03, 2018 8:01 pm
by alexouros
Hi, I have this script to get the currently selected layer comp's index (this is a section of it)

Code: Select all

for( var c = 0; c < doc.layerComps.length; c++ ){
if( doc.layerComps[c].selected == true ){
currentLayerCompID = c;
break;
}
}
The problem is I have over a thousand layer comps so this script takes a very long time to finish. Is there a way to get the ID without going through the whole list?
Thanks!


And a bonus question, is there a way to create a new layer comp and position it right after the one that's currently selected? Because LayerComp.add makes one at the end of the list.

Re: Get layer comp index?

Posted: Sun Nov 04, 2018 9:21 pm
by Kukurykus
Yes it is possible to do it within a half of second for 1000 layer comps, so about 30 times faster. For the applied one that would be even faster.

So that can be done surely in less than about 15 seconds, depending on one's processor. But why you have so many layer comps, 1000, really?

The bonus question is also accomplishable, so making next layer comp as consecutive to selected one than the last one that is set by default.

If you are dedicated to show here again, so not like others after writing a script for, going to vanish, send me PM to let me know about... ;)

Re: Get layer comp index?

Posted: Sun Nov 04, 2018 11:31 pm
by alexouros
Haha no, not going to ask a question and vanish. The reason I have a thousand layers is because I’m a storyboard artist and a thousand layers usually translate to about 200-300 panels which would be about 2-4 minutes of screen time. So right now I’m trying to find ways how scripts can improve my storyboarding workflow in photoshop.

Re: Get layer comp index?

Posted: Mon Nov 05, 2018 12:27 am
by Kukurykus
Okey script is sent, however I'm not sure I understand futher process so dividing layers into 250 panels (what I don't know what they are) and have you meant 1000 layer comps, so not just layers?

Re: Get layer comp index?

Posted: Mon Nov 05, 2018 12:56 am
by alexouros
Hey if there're other people who aren't asking $50 for some simple help, I'd really appreciate is someone could let me know how I could get layer comp index with javascript?