0 Replies Latest reply on Sep 24, 2012 1:24 AM by MacGritsch69

    Wait for activated fonts in open-event

    MacGritsch69 Level 1

      Hi there,

       

      in an open-event of a document I try to wait till the missing fonts are activated (using a font-manager-software).

       

      As a test, I run a loop counting the fonts known by indesign. if the count changes, I do an alert but it does not change after activating fonts in the fontmanager.

       

      If I enable the "alert", it shows me the new number (the round after the alert). So I think that opening the alert gives indeisgn time to check for new fonts.

      Is there a way how I can solve this (showing an alert every second is no solution ;-))

       

      Coding on Mac OS X 10.6.8 with CS 6

       

      here is the code:

       

      thank you!

       

       

       

      var lastFontCount = app.fonts.length;

       

      while (true)

      {

        $.sleep(1000);

       

                          app.updateFonts();

       

                          var currentFontCount = app.fonts.length;

       

        //alert("currentFontCount: " + currentFontCount);

       

                          if (currentFontCount != lastFontCount)

                          {

          alert("currentFontCount != lastFontCount // " + currentFontCount + " != " + lastFontCount);

          lastFontCount = currentFontCount;

                          }

      }