2 Replies Latest reply on May 17, 2010 1:03 PM by Miller42

    [JS] Finding/replacing glyphs not working

    Miller42

      I'm a self-taught newbie at this scripting thing. I'm trying to write a script that will eventually search for many different stray accent characters and change their font. I'll then manually look at all instances of the new font and decide how to address them on a case-by-case basis. Unfortunately, I can't even seem to get out of the starting gate. This is what I cobbled together so far, using an ampersand (glyphID: 9) as an example:

       

      //find/change glyph preferences
      
      app.findGlyphPreferences = NothingEnum.nothing;
      app.changeGlyphPreferences = NothingEnum.nothing;
      //search the document for the glyph and change it
      app.findGlyphPreferences.appliedFont = app.fonts.item("Charis SIL\tRegular");
      app.findGlyphPreferences.glyphID = 9;
      app.changeGlyphPreferences.appliedFont = app.fonts.item("Times\tRoman");
      //reset find/change glyph preferences
      app.findGlyphPreferences = NothingEnum.nothing;
      app.changeGlyphPreferences = NothingEnum.nothing;
       
      

       

      However, when I run it in my sample document, nothing happens. The ampersands stay in the same font, and no error is thrown. Any help would be most appreciated.