Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Glyph Find and Replace

Return to Member Forum

  • Author
    Posts
    • #1227637

      Hi All,
      Greetings.

      My code is below. I use ID CS6.

      function myFindGlyph(myObject){
      app.findGlyphPreferences = NothingEnum.nothing;
      app.changeGlyphPreferences = NothingEnum.nothing;
      app.findGlyphPreferences.appliedFont = app.fonts.itemByName(“SHREE-DEVXE-0709”);
      app.findGlyphPreferences.glyphID = 83;

      app.changeGlyphPreferences.appliedFont = app.fonts.itemByName(“SHREE_DEV_OTF_0709”);
      app.changeGlyphPreferences.glyphID = 45;
      myDocument.changeGlyph(false);
      app.findGlyphPreferences = NothingEnum.nothing;
      app.changeGlyphPreferences = NothingEnum.nothing;
      }

      When I run the js file, I get the following error.

      JavaScript Error!
      Error Number: 33801
      Error String: Invalid Find Font
      Source: myDocument.changeGlyph(false)

      I am able to Find/Change the text in Glyph, from the ID UserInterface itself. Problem arises, when I run the js. I am not sure where I am doing any mistake. Request you all to help me.

      Thanks in advance

    • #14323122
      Brian Pifer
      Participant

      In your function definition, you are passing an argument called myobject, but you are referencing myDocument in the function, which is not declared in scope, so it is undefined.

    • #14323121

      Thanks Brian,

      How silly am I!… I changed the code as follows:

      function myFindGlyph(myObject){
      app.findGlyphPreferences = NothingEnum.nothing;
      app.changeGlyphPreferences = NothingEnum.nothing;
      app.findGlyphPreferences.appliedFont = app.fonts.itemByName(“SHREE-DEVXE-0709”);
      app.findGlyphPreferences.glyphID = 83;

      app.changeGlyphPreferences.appliedFont = app.fonts.itemByName(“SHREE_DEV_OTF_0709”);
      app.changeGlyphPreferences.glyphID = 45;
      myObject.changeGlyph(true);
      app.findGlyphPreferences = NothingEnum.nothing;
      app.changeGlyphPreferences = NothingEnum.nothing;
      }

      Still I get the same error.

      JavaScript Error!
      Error Number: 33801
      Error String: Invalid Find Font
      Source: myObject.changeGlyph(false)

    • #14323120
      Brian Pifer
      Participant

      Where do you call the function in your main code? Are you sure you are passing a Document reference to it?

      Also are you sure that is the correct font in the findWhat? One has XE in the font name, while the change font name does not.

    • #14323118

      Hi Brian,

      Thanks for the reply. Yes, I am calling the function myFindGlyph from Main, via some other functions in between. I am sure that there are no errors in those functions.

      The font SHREE-DEVXE-0709 is a ttf type font. And, SHREE_DEV_OTF_0709 is a otf font.

      I tried with general Minion Pro for testing. Unfortunately, I met with the same result.

      Any thoughts?

    • #14323117
      Brian Pifer
      Participant

      If you’re sure you are passing a Document reference to myFindGlyph(doc) in main, only other thing I can think of is to ensure the find font is installed and you have the right glyph ID.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.
Forum Ads