5 Replies Latest reply on Aug 2, 2013 3:10 AM by JohnDevlon

    [5.5][AS][10.8] Error getting font info

    JohnDevlon Level 1



      I have a very weird problem using AppleScript and Indesign.


      I'm trying to check if a document has missing fonts.


      When running the script (from the finder), an error occures on some fonts when trying to check the font status.

      The script is able to check the font status on multiple fonts, but not all of them. The error trown: "Unable to retreive the font's UID from it's name".

      When debugging my script, it seems that the script is not able to get any property info of some fonts.


      My Applescript...


      tell application "Adobe InDesign CS5.5"


                tell active document


                          repeat with i from 1 to the number of fonts

                                         set myFont to item i of fonts

             display dialog status of myFont as string

                          end repeat


                end tell


      end tell


      When doing the same thing using a javascript and running it from within Indesign, all works well.


      var Doc = app.activeDocument;


      for (var z =0; z < app.activeDocument.fonts.length ; z++) {

          var test = app.activeDocument.fonts[z];









      Using the Javascript, I can loop over every font and get all of there properties. All works well.

      Why am i not able to check all font properties on all fonts using Applescript?


      Does anyone have a solution?



        • 1. Re: [5.5][AS][10.8] Error getting font info

          try this .....

          var myDoc = app.activeDocument;

          var myFonts= myDoc.fonts;

          var myMissing = new Array();

          var myCheckings  = MissingFonts()

          var count=0;

          function MissingFonts()


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


          if (myFonts[i].status!= FontStatus.INSTALLED)







          return myMissing;


          alert (myMissing.length)

          alert (myMissing)

          • 2. Re: [5.5][AS][10.8] Error getting font info
            JohnDevlon Level 1

            Thanks for your feedback. But like I mentioned: the problem occures only in Applescript.... In Javascript everything works fine...

            • 3. Re: [5.5][AS][10.8] Error getting font info
              JohnDevlon Level 1

              I found a temporary "fix"...



              set js to "function Check4MissingFonts() { var bolresult = false;for (var z =0; z < app.activeDocument.fonts.length ; z++) {if (app.activeDocument.fonts[z].status !=  \"INSTALLED\"){bolresult = true;break;};} return bolresult ; }; Check4MissingFonts();"


              tell application "Adobe InDesign CS5.5"

                do script js language javascript

                display dialog the result 

              end tell



              However, I still would like to know how it could be fixed in native Applescript...

              • 4. Re: [5.5][AS][10.8] Error getting font info
                JohnDevlon Level 1

                Apparently I spoke too soon.


                In some occassions. The error still occures...

                • 5. Re: [5.5][AS][10.8] Error getting font info
                  JohnDevlon Level 1

                  This seems to be more stable...


                  tell application "Adobe InDesign CS5.5"

                       tell active document


                            repeat with eachFont in fonts


                                           if (status of eachFont is not installed and status of eachFont is not not available) then


                                                     display dialog "Missing font!"

                                                     exit repeat


                                       on error errMsg

                                       end try

                              end repeat

                         end tell

                  end tell