1 Reply Latest reply on Jun 21, 2015 4:41 PM by Qwertyfly...

    Changing text and keeping the font style the same

    DuanesSearchForKnowledge Level 1

      Using Illustrator cs 5 / JavaScript


      I'm having a problem with keeping text styles like bold and Regular(not bold) from change.

      here is the problem

      say you want to change text like

      Scripting is not fun! to Scripting is fun!

      no problem...

      var docRef = app.activeDocument;

      var textRef1 = docRef.textFrames[0];

      textRef1.contents = "Scripting is fun!";


      but what if that text is like this


      Scripting is not fun! (with "Scripting" bold and the rest regular)

      when you run the same script it makes all the text bold

      Scripting is not fun! = Scripting is fun!

      or if "Scripting" is regular and the rest is bold it will turn all of it regular.

      Scripting is not fun! = Scripting is fun!

      How would we keep the styles from changing?

      any help would be appreciated.