6 Replies Latest reply on Apr 28, 2016 5:27 AM by karthiks94217840

    Multi script coding insert to dialog box

    karthiks94217840 Level 2

      Dear Friends,

       

      I was trying to script for "Multi script coding add to single script". I need to use dialog box. Since, i have done dialog box coding (See below my coding).

      But, i don't now how to add multi script coding in the dialog box inside?

       

      My Requirement: I want select any one script button. I need to run that select script code only. Otherwise, other script code no needed to run.

       

      Example:

       

      1. I will pick 1 script "01_Overrodes" just i want to run this script only.
      2. I will pick 2 script "02_FindText" just i want to run this script only.
      3. I will pick 3 script "03_Alert_Basic Replace" just i want to run this script only.

       

      Screen Shot 2016-04-28 at 3.40.40 PM.png

       

       

      var  
        w=new Window("dialog", "Action List"),  
        radio=w.add("panel", undefined, "Choose Action"),  
        option1=radio.add("radiobutton", undefined, "01_Overrodes"),  
        option2=radio.add("radiobutton", undefined, "02_FindText"),  
        option3=radio.add("radiobutton", undefined, "03_Alert_Basic Replace"),  
        option4=radio.add("radiobutton", undefined, "04_Tracking, Kerning and Nonbreak");    
        option5=radio.add("radiobutton", undefined, "05_Colour Remove");    
        option6=radio.add("radiobutton", undefined, "06_Foilo order");    
        
        w.add ("button", undefined, "OK") 
        option1.value = true;    
          radio.alignChildren="left";    
          radio.margins = [10,10,50,10];  
        
        
      
      
      //where is i add my coding
      
        
        
      if (w.show() == 1){      
           if (option1.value) alert("Action One!");  
           if (option2.value) alert("Action Two!");  
        if (option3.value) alert("Action Three!");  
        if (option4.value) alert("Action Four!");
        if (option5.value) alert("Action Four!");
        if (option6.value) alert("Action Four!");
          }    
      else {      
          exit();      
          };  
      
      
      
      var  
      

       

      Please Help and suggest me friends.

       

       

      Advance Thanks

        • 1. Re: Multi script coding insert to dialog box
          b91823603 Level 3

          Hi karthi,

           

          try like this,

               if (option1.value){

                      var scpt = "D:\source1.jsx";

                      app.doScript(scpt, ScriptLanguage.javascript);

               }

               if (option2.value) {

                   var scpt = "D:\source2.jsx";

                  app.doScript(scpt, ScriptLanguage.javascript);

              }   

               if (option3.value) {

                   var scpt = "D:\source3.jsx";

                  app.doScript(scpt, ScriptLanguage.javascript);

              }

              if (option4.value) {

                   var scpt = "D:\source4.jsx";

                  app.doScript(scpt, ScriptLanguage.javascript);

              }

              if (option5.value) {

                   var scpt = "D:\source5.jsx";

                  app.doScript(scpt, ScriptLanguage.javascript);

              }

              if (option6.value) {

                   var scpt = "D:\source6.jsx";

                  app.doScript(scpt, ScriptLanguage.javascript);

              }

          • 2. Re: Multi script coding insert to dialog box
            tpk1982 Level 4

            the simple way is using function... just call the function in the place of alert

             

            otherwise we can use #include scriptname.jsx;

            • 3. Re: Multi script coding insert to dialog box
              karthiks94217840 Level 2

              Hi B & TPk

               

              I have work out your both coding. But, not working friend.

               

              @B: I am insert your code. That script "option1.value" only is working. otherwise, not working for other script coding.

                     Marge code is below. Please tell where is i am mistake? suggest B.

               

              \\\\\\\\\\\\\\\

              var 

                w=new Window("dialog", "Action List"), 

                radio=w.add("panel", undefined, "Choose Action"), 

                option1=radio.add("radiobutton", undefined, "01_Overrodes"), 

                option2=radio.add("radiobutton", undefined, "02_FindText"), 

                option3=radio.add("radiobutton", undefined, "03_Alert_Basic Replace"), 

                option4=radio.add("radiobutton", undefined, "04_Tracking, Kerning and Nonbreak");   

                option5=radio.add("radiobutton", undefined, "05_Colour Remove");   

                option6=radio.add("radiobutton", undefined, "06_Foilo order");   

               

                w.add ("button", undefined, "OK")

                option1.value = true;   

                  radio.alignChildren="left";   

                  radio.margins = [10,10,50,10]; 

               

              if (option1.value){

                          var scpt = "/Users/stype/Desktop/0/01_Overrodes.jsx";

                          app.doScript(scpt, ScriptLanguage.javascript);

                   }

                   if (option2.value) {

                       var scpt = "/Users/stype/Desktop/0/02_FindText.jsx";

                      app.doScript(scpt, ScriptLanguage.javascript);

                  }  

                   if (option3.value) {

                       var scpt = "/Users/stype/Desktop/0/03_Alert_Basic Format.jsx";

                      app.doScript(scpt, ScriptLanguage.javascript);

                  }

                  if (option4.value) {

                       var scpt = "/Users/stype/Desktop/0/04_Tracking, Kerning and Nonbreak.jsx";

                      app.doScript(scpt, ScriptLanguage.javascript);

                  }

                  if (option5.value) {

                       var scpt = "/Users/stype/Desktop/0/05_Colour Remove.jsx";

                      app.doScript(scpt, ScriptLanguage.javascript);

                  }

                  if (option6.value) {

                       var scpt = "/Users/stype/Desktop/0/06_Foilo order.jsx";

                      app.doScript(scpt, ScriptLanguage.javascript);

              }

               

               

              if (w.show() == 1){     

                   if (option1.value) alert("Action One!"); 

                   if (option2.value) alert("Action Two!"); 

                if (option3.value) alert("Action Three!"); 

                if (option4.value) alert("Action Four!");

                if (option5.value) alert("Action Four!");

                if (option6.value) alert("Action Four!");

                  }   

              else {     

                  exit();     

                  }; 

               

              /////////////////////

               

              @Tpk: I was try to your suggestion also, this also not working. Please see below code.

               

               

              \\\\\\\\\\\\\\\\\\\

              var 

                w=new Window("dialog", "Action List"), 

                radio=w.add("panel", undefined, "Choose Action"), 

                option1=radio.add("radiobutton", undefined, "01_Overrodes"), 

                option2=radio.add("radiobutton", undefined, "02_FindText"), 

                option3=radio.add("radiobutton", undefined, "03_Alert_Basic Replace"), 

                option4=radio.add("radiobutton", undefined, "04_Tracking, Kerning and Nonbreak");   

                option5=radio.add("radiobutton", undefined, "05_Colour Remove");   

                option6=radio.add("radiobutton", undefined, "06_Foilo order");   

               

                w.add ("button", undefined, "OK")

                option1.value = true;   

                  radio.alignChildren="left";   

                  radio.margins = [10,10,50,10]; 

               

               

               

              if (w.show() == 1){     

                   if (option1.value) function(){"Action One!" + "/Users/stype/Desktop/0/01_Overrodes.jsx"+ app.doScript(ScriptLanguage.javascript)}; 

                   if (option2.value) function(){"Action Two!" + "/Users/stype/Desktop/0/02_FindText.jsx"+ app.doScript(ScriptLanguage.javascript)}; 

                if (option3.value) function(){"Action Three!" + "/Users/stype/Desktop/0/03_Alert_Basic Format.jsx"+ app.doScript(ScriptLanguage.javascript)}; 

                if (option4.value) function(){"Action Four!" + "/Users/stype/Desktop/0/04_Tracking, Kerning and Nonbreak.jsx"+ app.doScript(ScriptLanguage.javascript)};

                if (option5.value) function(){"Action Four!" + "/Users/stype/Desktop/0/05_Colour Remove.jsx" + app.doScript(ScriptLanguage.javascript)};

                if (option6.value) function(){"Action Four!" + "/Users/stype/Desktop/0/06_Foilo order.jsx" + app.doScript(ScriptLanguage.javascript)};

                  }   

              else {     

                  exit();     

                  }; 

               

              \\\\\\\\\\\\\\\\\\\\\\

               

              Please suggest this type of coding method.

                 

               

              Advance thanks

              • 4. Re: Multi script coding insert to dialog box
                tpk1982 Level 4

                if (option1.value) {

                    Action_One();

                    };

                 

                function Action_One(){

                   

                    //paste you coding here. not the script path

                   

                    }

                • 5. Re: Multi script coding insert to dialog box
                  b91823603 Level 3

                  Hi karthi,

                   

                  You can use like this also,

                   

                  var

                    w=new Window("dialog", "Action List"),

                    radio=w.add("panel", undefined, "Choose Action"),

                    option1=radio.add("radiobutton", undefined, "01_Overrodes"),

                    option2=radio.add("radiobutton", undefined, "02_FindText"),

                    option3=radio.add("radiobutton", undefined, "03_Alert_Basic Replace"),

                    option4=radio.add("radiobutton", undefined, "04_Tracking, Kerning and Nonbreak"); 

                    option5=radio.add("radiobutton", undefined, "05_Colour Remove"); 

                    option6=radio.add("radiobutton", undefined, "06_Foilo order"); 

                   

                    w.add ("button", undefined, "OK")

                    option1.value = true; 

                      radio.alignChildren="left"; 

                      radio.margins = [10,10,50,10];

                   

                   

                   

                  if (w.show() == 1){   

                    if (option1.value){app.doScript(File(Folder.desktop+"/0/01_Overrodes.jsx"),ScriptLanguage.ja vascript)};

                    if (option2.value){app.doScript(File(Folder.desktop+"/0/02_FindText.jsx"),ScriptLanguage.jav ascript)};

                    if (option3.value){app.doScript(File(Folder.desktop+"/0/03_Alert_Basic Format.jsx"),ScriptLanguage.javascript)};

                    if (option4.value){app.doScript(File(Folder.desktop+"/0/04_Tracking, Kerning and Nonbreak.jsx"),ScriptLanguage.javascript)};

                    if (option5.value){app.doScript(File(Folder.desktop+"/0/05_Colour Remove.jsx"),ScriptLanguage.javascript)};

                    if (option6.value){app.doScript(File(Folder.desktop+"/0/06_Foilo order.jsx"),ScriptLanguage.javascript)};

                      } 

                  else {   

                      exit();   

                      };

                  • 6. Re: Multi script coding insert to dialog box
                    karthiks94217840 Level 2

                    Hi B & Tpk.

                     

                    @B: Very very thanks you so mach B. I am very happy.

                     

                    @TPK: Very very thanks you so mach for your approached tpk.

                     

                    Thanks Friends.