2 Replies Latest reply on Dec 17, 2012 4:55 AM by davidDav

    help!!! Apply highlight to typed one in Dialog box

    indegn5 Level 1

      Hi everybody!,

       

      I m so bad in basic scripting, begginer,  but anyway i managed to do atlease this....

       

      things is: if you run the script... we can create conditional text and delete the conditions.....the half script runs.....

       

      but i m trying to type the desired text in "dialog box" blank field and then apply conditonal text for that.....but nothing happens...

       

      can anybody help on this...

       

       

      var mydoc = app.documents.item(0);

      var myDialog = new Window('palette', 'Conditional Text');

      var myGroup = myDialog.add('group', undefined, '');

      myGroup.orientation = "column";

       

       

      myGroup.add("statictext", undefined, "Type to find here");

      var myText = myGroup.add("edittext", undefined, "myText");

      myText.characters = 100;

      myText.active = "true";

      var str = myText;

      var newButton1 = myGroup.add('button', undefined, 'Highlight Words', {name:'Button'});

      var newButton2 = myGroup.add('button', undefined, 'Remove Highlight', {name:'Button'});

      myGroup.alignChildren = "center";

      myDialog.show();

       

      newButton1.onClick = function() {

      myCondition = app.activeDocument.conditions.add ({name:"Condition 1",

      indicatorMethod:ConditionIndicatorMethod.USE_HIGHLIGHT, indicatorColor:UIColors.YELLOW});

       

       

      if (!myCondition.isValid)

      {

      app.findGrepPreferences = NothingEnum.nothing;

      app.changeGrepPreferences = NothingEnum.nothing;

       

       

      app.findGrepPreferences.findWhat.onChange =  function () {myText.text = mytext.selection};

      app.findGrepPreferences.fontStyle = "Regular";

      app.changeGrepPreferences.appliedConditions = ["Condition 1"];

      app.changeGrep();

      }

      }

       

      newButton2.onClick = function()

      {

      myCondition.remove();

       

       

      }

        • 1. Re: help!!! Apply highlight to typed one in Dialog box
          shilpa25 Level 1

          hi,

           

          try this, this should help you.. //

           

          app.findGrepPreferences.findWhat = myText.text;

          myText.onChanging = function () {$.Writeln (app.findGrepPreferences.findWhat.text)};

          app.findGrepPreferences.fontStyle = "Regular";

          app.changeGrepPreferences.appliedConditions = ["Condition 1"];

          app.changeGrep();

           

          thanks

          shil...

          • 2. Re: help!!! Apply highlight to typed one in Dialog box
            davidDav

            hi forum,

             

            using indegn5, script, i tried to create dropdownlist for fontstyle....

             

            necessity is: if i type the text in editfield using selected fontstyle, the highlight should, if the document stories has the selected fontstyle...

             

            but only the highlight is created and highlight is not applied to the selected font style...

             

            can anyone look at this and make a tweak;

             

            --------------------------

             

            var myDoc = app.activeDocument;

            var myDialog = new Window('palette', 'Highlight_unbold_Gobally');

            var myGroup = myDialog.add('group', undefined, '');

            myGroup.orientation = "column";

            myGroup.add("statictext", undefined, "Type to find here");

            var myText = myGroup.add("edittext", undefined, "");

            myText.characters = 20;

            myText.active = "true";

             

            var arrays = ["select font style", "Regular", "Medium", "Bold", "Italic", "Bold Italic"];

            var ddown= myGroup.add("dropdownlist", undefined, array);

            ddown.minimumSize.width = myDialog.preferredSize = [300, 200];

            ddown.selection = 0; ddown.active = true;

             

            var newButton1 = myGroup.add('button', undefined, 'Highlight Words', {name:'Button'});

            var newButton2 = myGroup.add('button', undefined, 'Clear Highlight', {name:'Button'});

            myGroup.alignChildren = "center";

            myDialog.show();

             

            newButton1.onClick = function() {

            myCondition = app.activeDocument.conditions.add ({name:"Highlight_Text",

            indicatorMethod:ConditionIndicatorMethod.USE_HIGHLIGHT, indicatorColor:UIColors.YELLOW});

             

            if (!myCondition.isValid) {

            app.findGrepPreferences = NothingEnum.nothing;

            app.changeGrepPreferences = NothingEnum.nothing;

            }

             

            app.findGrepPreferences.findWhat = myText.text;

            myText.onChanging = function () {$.Writeln (app.findGrepPreferences.findWhat.text)};

            for (i=0; i>arrays.length; i++){

                array = arrays[i];

            if (myText.appliedfontStyle.name == "");

            ddown.onChanging = function () {$.Writeln (app.findGrepPreferences.appliedFontStyle = arrays.onClick)};

            app.changeGrepPreferences.appliedConditions = ["Highlight_Text"];

            app.changeGrepPreferences.appliedFontStyle = ["arrays"];

            app.changeGrep();

            }

            }

            newButton2.onClick = function()

            {

            myCondition.remove();

            }