8 Replies Latest reply on Mar 13, 2017 1:01 PM by Kasyan Servetsky

    Run FindChangeByList script using another script to load in a book

    sonyzach

      I have a book contains 66 documents in which i want to find words which are incorrect and change it using the FindChangeByList.jsx sample script. But it crashes with error.

      i am using this  Change scripts to run through multiple documents in a book, rather than just the open document to load my Book but crashes with this error message pasted below ErrorScrn.png

      the code i used to run FindChangeByList is :

       

       

      main(); 

      exit(); 

       

       

      function main() { 

       

           var myBook = app.open(File("C:\\Users\\sony.zacharia\\Desktop\\BCS\\Bible.indb")), myDoc; 

           $.writeln(myBook.name)

           var myDocs = myBook.bookContents.everyItem().getElements(); 

           for (var i=0; i< myDocs.length; i++) { 

                // must be adapted to your needs 

                myDoc = app.open(File("C:\\Users\\sony.zacharia\\Desktop\\BCS\\" + myDocs[i].name)); 

                  $.writeln (myDoc.name)

                 

                  var myFile = new File ("C:\\Program Files\\Adobe\\Adobe InDesign CC 2017\\Scripts\\Scripts Panel\\Samples\\JavaScript\\FindChangeByList.jsx"); 

                  $.writeln (myFile.name)

                  if (myFile.exists)  {  

                 app.doScript(myFile, ScriptLanguage.JAVASCRIPT);

                  }

                myDoc.close(); 

           } 

       

      Please help me to sort this issue. Thanks in advance!