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

I'm giving inline object style with underlined words. But!

Return to Forums

  • Author
    Posts
    • #92263
      Anonymous
      Inactive

      app.doScript(“main()”, ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, “boxor Text Selection! …”);

      function main()
      {

      try {
      var myOStyle = app.activeDocument.objectStyles.item(“box”);
      myOStyle.name;
      } catch (e) {
      var myOStyle = app.activeDocument.objectStyles.add({name: “box”, enableFill: true, enableStroke: false});
      }

      app.findGrepPreferences = NothingEnum.nothing;
      app.findGrepPreferences = NothingEnum.nothing;
      //app.findGrepPreferences.findWhat = “w+”;
      app.findGrepPreferences.underline = true;
      var myFind = app.selection[0].findGrep();

      for (i = 0; i < myFind.length; i++)

      {
      var box = myFind[i];
      var myLeading = box.leading;

      // remove underline to character style
      var myCstyle=app.activeDocument.characterStyles.item(“[None]”);
      box.applyCharacterStyle(myCstyle);
      box.clearOverrides(OverrideType.CHARACTER_ONLY);

      // create textFrame

      var myFrame = box.insertionPoints[-1].textFrames.add();
      box.characters.itemByRange(0, box.characters.length-2).move (LocationOptions.after, myFrame.insertionPoints[0]);
      myFrame.textFramePreferences.autoSizingType = AutoSizingTypeEnum.HEIGHT_AND_WIDTH;
      myFrame.textFramePreferences.useNoLineBreaksForAutoSizing = true;
      myFrame.insertionPoints[0].leading = myLeading;
      myFrame.applyObjectStyle(myOStyle);
      }

      }

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