2 Replies Latest reply on Nov 13, 2009 12:51 AM by kujtimkerqeli





      if some one can help me with the javascript code in design to find a refered word in a book and how many time is used that word  there
      to take the word with a  document with *tex and to compared with book and to create a file in *tex  with date how many times is used that word in the book

        • 1. Re: kujtim
          [Jongware] Most Valuable Participant

          The findText method automatically finds all occurrences of the text you enter in findTextPreferences -- the result is returned as an array, and its length is the number of occurrences:


          // set "entire word" in find props:
          app.findChangeTextOptions.wholeWord = true;
          // ask for a word.
          theWord = prompt ("Enter a word. Any word.");
          if (theWord != null)
            // put into Find..
            app.findTextPreferences = null;
            app.findTextPreferences.findWhat = theWord;
            // Go look for it:
            result = app.activeDocument.findText();
            // Report usage:
            alert ('Found "'+theWord+'" a total of '+result.length+' times');


          You used the word "book", which for InDesign might indicate you have multiple documents, kept together using the Book panel. Is that correct? Because in that case, you would need to first open all documents of that book, and then search all open documents. You cannot search the contents of a "Book".


          You lost me in the second half. What is "*tex", and what should be created?

          • 2. Re: kujtim
            kujtimkerqeli Level 1

            in the book should apply a word how many times is used in the book and tell us in which page it has been used that word,that word i shoud take from a file that have the suffix book.tex with date request ,book.tex to loging mood is app.dialogs.add(file.opendialog(solve filin.tex"));