3 Replies Latest reply on Jun 22, 2014 7:49 PM by hasvi

    Create alert message

    hasvi Level 1

      Hi,

       

       

      If my indesign file has 'font missing', 'Missing links', and 'Overflow Text', I have to give the alert message by script. Is this possible?

       

       

      by

      hasvi

        • 1. Re: Create alert message
          BEGINNER_X Level 3

          Hi Hasvi,

           

          Below is the answer:

           

          if(app.documents.length == 0)
          {
              alert("Please Open the Document");
              exit(0);
              }
          
          var myDoc = app.activeDocument;
          
          
          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
          
          
              var myUsedFonts = myDoc.fonts;
          
              for (var i = 0; i < myUsedFonts.length; i++) {
              if (myUsedFonts[i].status != "1718831470") 
              {
                  alert("Please Fix Missing Font")
                  exit(0);
                  }
              }
          
              var myUsedLinks = myDoc.links;
              for (var i = 0; i < myUsedLinks.length; i++) 
              {
                  if (myUsedLinks[i].status == LinkStatus.linkMissing || myUsedLinks[i].status == LinkStatus.LINK_OUT_OF_DATE) 
                  {
                      alert("Please Fix Missing Link");
                      exit(0);
                      }
                  }
          
          
              
              var myOverflow = FindOverflowText();
              if (myOverflow == true) 
              {
                  alert("Please Fix Overflow")
                  exit(0);
                  }
              
          
          
          //Function FindOverflowText Start
          function FindOverflowText() {
              myPages = myDoc.pages;
              for (i = myPages.length - 1; i >= 0; i--) {
                  objTextFrames = myPages[i].textFrames;
                  for (j = objTextFrames.length - 1; j >= 0; j--) {
                      objTextFrame = objTextFrames[j];
                      if (objTextFrame.overflows == true) {
                          objTextFrame.select();
                          return true;
                      }
                  }
              }
              return false;
          }
          

           

           

          If my coding helps you, then please click the correct answers.

           

          Thanks

          Siraj

          • 3. Re: Create alert message
            hasvi Level 1

            Hi Siraj,

             

            thanks a lot for your answer.

             

            by

            hasvi