Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

Script - Create dropdownlist from layer comments not working as intended

$
0
0

Heyo everyone!

 

Im trying to make a list of all the comments ive added to my layers, but i dont want any duplicates.

I want add the items to a dropdownlist.

 

It seems it uses the if(found == false){ before the if(commentLayer[c] == panel.Label.R3.L1.items[k]){ ??

what it does now is create a new items for every comment including the duplicates.

 

This is the code i have now:

 

                   panel.Label.R3.refresh.onClick = function (){

                       alert("Refreshing list!");

                       var comp = app.project.activeItem;

                       var numlayer = comp.numLayers + 1;

                       for (i = 1; i < numlayer; i++){

                           var commentLayer = comp.layer(i).comment.split("|");

                           for (c = 0; c < commentLayer.length; c++) {

                               var found = false;

                               var numList = panel.Label.R3.L1.items;

                               for (k = 0; k < numList.length; k++) {

                                  if(commentLayer[c] == panel.Label.R3.L1.items[k]){

                                       alert("found!")

                                       found = true;

                                   }

                               }

                                if(found == false){

                                    panel.Label.R3.L1.add("item", commentLayer[c]);

                                    panel.Label.R3.L1.selection = 0;

                                    alert(found)

                                }

                            }

                        }

                   }

 

im kinda new to scripting so its possibly not the best way to do this

 

Do you guys know what im doing wrong? i cant figure it out.

 

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 2143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>