2 Replies Latest reply on Jun 12, 2012 4:12 AM by DavidJH2o

    Keyword Update Error

    DavidJH2o

      I have the following javascript

      var myc = 20;

      while (myc<60) {

        if(this.getPageNthWord(0,myc) = "Stock")

          { this.info.keywords = this.getPageNthWord(0,(myc+2));

            myc = 60 ;

          }

        myc++;

        }

       

      This does not do anything in My PDF files the word Stock is the 43th word and the 45th word is 39996 on the page on the PDF tested.

      but this has not updated the Keywords to include 39996

      Is my if test may be at fault. or the assignment this.info.keywords = this.getPageNthWord(0,(myc+2));

      Do you have any suggestions.

        • 1. Re: Keyword Update Error
          gkaiseril MVP & Adobe Community Professional

          It is not the setting of  the keyword, but the line after that action which sets your variable "myc" to 60.

          • 2. Re: Keyword Update Error
            DavidJH2o Level 1

            Please Note the problem with this code is the assignment

             

              if(this.getPageNthWord(0,myc) = "Stock")

             

            it should read as follows

             

              if(this.getPageNthWord(0,myc) == "Stock") because we are testing the value and not assigning the value

             

            Once this small change was made it works. Hard to find as a novice.

            Thank you to all who have helped and I hope this will help others also