4 Replies Latest reply on Mar 26, 2014 1:40 AM by tobias.wantzen

    [CC, JS]: Supress Typekit Warning

    tobias.wantzen Level 1

      Hello together,

       

      after opening a document in my script, I tried to test, whether all needed fonts are installed with Dave Saunders hint:

      try {

        fontLocs = app.activeDocument.fonts.everyItem().location;

      } catch (e) {

        errorExit("Active document has missing fonts; please correct using Type/Find Font and try again.");

      }

       

      But testing this by deactivating needed fonts and running the script, there is the Typekit font alert, which prompts directly after opening the doc and the routine I implemented is ignored.

       

      Are there any ways around this?

       

      Thanks!

      Tobias

        • 1. Re: [CC, JS]: Supress Typekit Warning
          Jump_Over Level 5

          Hi,

           

          Missing and deactivating differ, I am afraid.

          Possibly deactivated still has a path (cann't check it). You can check it comparing font.location.

          If yes - you should back to the way with looping through for status.

          However one can exam a result string of this (no loop):

          mString = app.activeDocument.fonts.everyItem().status.join();
          

           

          playing with string.match() or string.search() leads to needed alert, i.e:

          if (mString.match(/installed/ig).length != app.activeDocument.fonts.length)
               alert ("some missing font detected");
          

           

          Jarek

          1 person found this helpful
          • 2. Re: [CC, JS]: Supress Typekit Warning
            tobias.wantzen Level 1

            Hi Jarek,

             

            that’s not my problem. David’s code works perfectly fine, when the document is already open and the fonts are missing. But when I do this:

             

            _dok = app.open("/path/to/the/document/xyz.indd");

            try {

              fontLocs = _dok.fonts.everyItem().location;

            } catch (e) {

              alert("Active document has missing fonts; please correct using Type/Find Font and try again.");

            }

             

            InDesign opens the doc, but immediately shows the Typekit dialogue »missing fonts«. After closing the Typekit dialogue nothing more happens – the script’s font check simply is ignored.

             

            Any suggestions?

            Tobias

            • 3. Re: [CC, JS]: Supress Typekit Warning
              Jump_Over Level 5

              Hi,

               

              What about switching this:

              app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;

              app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;

               

              Jarek

              1 person found this helpful
              • 4. Re: [CC, JS]: Supress Typekit Warning
                tobias.wantzen Level 1

                Hej Jarek,

                 

                thanks for your kind support. I used a combination of both of your hints and it works. With Dave’s code it doesn’t.

                 

                Thanks a lot!

                Tobias