Skip to main content
bagonterman
Inspiring
July 30, 2013
Question

Count number of matches.

  • July 30, 2013
  • 1 reply
  • 507 views

I am adding some code on to an existing script. What i am trying to do is match the files against files located as a back up on the server. Verifying that they are all there. I have been able to match them but now I want to count how many matches i have. This should be easy but I am confused.

for ( i = 0; i < count; i++ ) {

      

         file = doc.visibleThumbnails.spec.toSource();

         f =doc.visibleThumbnails.name.slice(0,10);

        pageImage =doc.visibleThumbnails.name;

        extractName=boot.name;

        var myMatch=0;

    for (var j = 0; j < boot.length; j++) {

  

        if((pageImage.match ( boot.name))){myMatch=myMatch++; }        

        }

   

    alert(myMatch);

}

I thought I could just asign ++ to a var but its not working.

This topic has been closed for replies.

1 reply

bagonterman
Inspiring
August 1, 2013

I ended up not counting really but pushing each object as a string. Then counting the objects in the array by using length.


for (var j = 0; j < boot.length; j++) {

if(boot.type!="????"){ myArchive.push(boot.name);}

for ( i = 0; i < count; i++ ) {

pageImage =doc.visibleThumbnails.name;

if((pageImage.match ( boot.name))){  myMatches.push(boot.name);}

}

};