2 Replies Latest reply on May 9, 2016 6:54 AM by cbishop01

    Search Script Troubles !!

    cbishop01 Level 2

      Ok i thought i had this working but apparently i did not.  How can i get this to Search for only each object that's checked in the check box?  and Display a dialog box telling what all has been changed when certain check boxes are checked.  RunCH1, RunCH2, and RunCH3 are the names of the check boxes i have.  I thought i had the find/replace working yesterday but i must have not been paying attention. it will do the first set of changes and teh second but it will not do the 3rd change.  and no matter which one i have selected (or not selected) i get all 3 alert messages.  I only want the alert message for the selected change.  If you need the rest of teh code let me know and i'll paste it below.  Thanks in advance.

       

      // How do i make each CHECK BOX RunCH1/2/3 Only work when they are selected?  I cannot figure out how to make 2&3 Work.
      
      
              if(myResult == 1 && (RunCH1.value==true || RunCH2.value==true || RunCH3.value==true) ){  
                  alert("Find and Replace Items Have been made.!")
                      Replace_TXT(" <CR> ", "^p");
                      Replace_TXT(" <CR>", "^p");
                      Replace_TXT("  ", " ");
                      Replace_TXT(" :", ":");
                      Replace_TXT(" .", ".");
                      Replace_TXT("^p^p", "^p");
                      
                     
                    
                  if(myResult == 2 && (RunCH2.value==true ) );
                 
                      Replace_TXT ("test", "asdfasdfasdfadsfasdfasdfasdfadfasdfasdf"); 
                          
               {  
                          alert ("RunCH2 Changes Made")  
               }; 
           
                  if(myResult == 3 && (RunCH3.value==true) ){  
                      Replace_TXT("and", "TEST");
                }  
                         alert ("RunCH3 Changes Made")  
                }; 
                  w.close(true);     
          
           
          function Replace_TXT(input, output)  
          {  
          app.findChangeTextOptions.caseSensitive = true;  
          app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;  
          app.findTextPreferences.findWhat = input;  
          app.changeTextPreferences.changeTo = output;  
          app.activeDocument.changeText();  
          }
      
        • 1. Re: Search Script Troubles !!
          tpk1982 Level 4

          try this with your main script file what you posted in other thread.. i think your requirement is big.. the myResult==1 is used whether we pressed ok and 2 is for we pressed cancel.. hope you understood now

           

          // How do i make each CHECK BOX RunCH1/2/3 Only work when they are selected?  I cannot figure out how to make 2&3 Work.  
          if(myResult == 1 && (RunCH1.value==true)){    
          alert("Find and Replace Items Have been made.!")  
          Replace_TXT(" <CR> ", "^p");  
          Replace_TXT(" <CR>", "^p");  
          Replace_TXT("  ", " ");  
          Replace_TXT(" :", ":");  
          Replace_TXT(" .", ".");  
          Replace_TXT("^p^p", "^p");  
          }
          if(myResult == 1 && (RunCH2.value==true ) ){  
          Replace_TXT ("test", "asdfasdfasdfadsfasdfasdfasdfadfasdfasdf");   
          alert ("RunCH2 Changes Made")    
          };   
          if(myResult == 1 && (RunCH3.value==true) ){    
          Replace_TXT("and", "TEST");  
          alert ("RunCH3 Changes Made")    
          };   
          w.close(true);       
          
          function Replace_TXT(input, output)    
          {    
          app.findChangeTextOptions.caseSensitive = true;    
          app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;    
          app.findTextPreferences.findWhat = input;    
          app.changeTextPreferences.changeTo = output;    
          app.activeDocument.changeText();    
          }  
          
          1 person found this helpful
          • 2. Re: Search Script Troubles !!
            cbishop01 Level 2

            You my friend are a miracle worker. Thanks again.