2 Replies Latest reply on Mar 15, 2017 7:43 AM by bsf76995802

    script will run on one file but won't run on different file

    bsf76995802

      Hi,

       

      I wrote a script (see below) in InDesign SC6 (version8). The purpose of the script is to change certain text to uppercase based on font selection.

      The script runs great on the original file I had, but then someone sent me another InDesign file, and I get an error 24 ("is not a function").

      I am including a screen shot of the error message.

      I'm on Window 8.1 Enterprise.

       

      What do I have to do to make the script run on ALL InDesign files?

       

      Thanks

      Beate

       

       

       

      var myTexts = app.activeDocument.stories.everyItem().textStyleRanges.everyItem().getElements(); 

       

      myTexts = myTexts.concat(app.activeDocument.everyItem().tables.everyItem().cells.everyItem().textSt yleRanges.everyItem().getElements()); 

       

      for (var n=myTexts.length-1; n>=0; n--){ 

        

          var isIntelPro= myTexts[n].appliedFont.name.search("Intel Clear Pro");

          var isIntelBold=myTexts[n].appliedFont.name.search("Intel Clear    Bold");

        

          if (isIntelPro > -1)  {  

              myTexts[n].changecase(ChangecaseMode.uppercase);   

            }

          else if (isIntelBold > -1) {

              myTexts[n].changecase(ChangecaseMode.uppercase);

              }