1 Reply Latest reply on Dec 13, 2010 10:06 AM by Mi_D

    Add Find & Replace buttons

    kerosk_indd

      Hello All,

       

      Below is the my code to find empty text frames in my documents.

       

      I want a dialog which show me 4 buttons 1. cancel, 2. Skip, 3, Show and 4. Delete buttons in my Dialog.

       

      My below code finds text frames but I need to add onClick code on above buttons Please help me with this code..

       

       

       

      JS code-------------

       

      EmptyTf= app.activeDocument.layers.item(0).textFrames;
      for (etf=0; etf<EmptyTf.length; etf++)
      if (EmptyTf[etf].contents<=0)
      {
      app.select(EmptyTf[etf]);
      alert ("Selected  is EMPTY Textframe.\r"+"Textframe selected "+[etf]+".");
      }

       

       

       

      Thanks,

      kerosk

        • 1. Re: Add Find & Replace buttons
          Mi_D Level 3

          Dear kerosk,

           

          try below code

           

           

          var myDialog = app.dialogs.add({name:"MI_D"+"      ", canCancel:true});

          with(myDialog){

                    with(dialogColumns.add()){

                         with(borderPanels.add()){

                         staticTexts.add({staticLabel:"Chose Operation:"});

                         var myRadioButtonGroup = radiobuttonGroups.add();

                              with(myRadioButtonGroup){

                                   var ShowRadioButton = radiobuttonControls.add({staticLabel:"Show"});

                                   var DeletetageRadioButton = radiobuttonControls.add({staticLabel:"Delete "});

                                   var DeletetageRadioButton = radiobuttonControls.add({staticLabel:"Skip "});

           

           

                                   }

                              }

               }

           

          if(myDialog.show() == true){

               if(myRadioButtonGroup.selectedButton==0){

                    {

                         EmptyTf= app.activeDocument.layers.item(0).textFrames;

                         for (etf=0; etf<EmptyTf.length; etf++)

                         if (EmptyTf[etf].contents<=0)

                         {

                         app.select(EmptyTf[etf]);

                         alert ("Selected  is EMPTY Textframe.\r"+"Textframe selected "+[etf]+".");

                         }

                    }

               }

           

                         if(myRadioButtonGroup.selectedButton==1){

                              {

                                   EmptyTf= app.activeDocument.layers.item(0).textFrames;

                                        for (etf=0; etf<EmptyTf.length; etf++)

                                        if (EmptyTf[etf].contents<=0)

                                             {

                                             app.select(EmptyTf[etf]);

                                             var select=app.selection[etf];

                                              select.remove();

                                             alert ("Selected  is EMPTY Textframe.\r"+"Delete  "+[etf]+".");

                                   }

                              }

                    }

                              if(myRadioButtonGroup.selectedButton==2){

                    {

                         EmptyTf= app.activeDocument.layers.item(0).textFrames;

                              for (etf=0; etf<EmptyTf.length; etf++)

                              if (EmptyTf[etf].contents<=0)

                                   {

                                        app.select(EmptyTf[etf]);

                                             var select=app.selection[0];

                                             var select=app.selection[etf+1];

                                             alert ("Next"+[etf]+".");

                                        }

                                   }

           

                              }

           

                    }

               }