Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Search Script Troubles !!

Advisor ,
May 08, 2016 May 08, 2016

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(); 

    }

TOPICS
Scripting
262
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , May 08, 2016 May 08, 2016

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("  ",

...
Translate
Guide ,
May 08, 2016 May 08, 2016

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();   

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 09, 2016 May 09, 2016
LATEST

You my friend are a miracle worker. Thanks again.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines