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.
You need to actually do the replacement.
will do the replacement on the entire document.
Thanks! That did the trick!