0 Replies Latest reply on Jul 24, 2014 5:23 AM by Teetan VK

    How can join three scripts together?

    Teetan VK Level 1

      Hi everyone, I got three scripts:

       

      1st script:

       

      Main();

      function Main() {
      var docs = app.documents;
      for (var i = docs.length-1; i >= 0; i--) {
        docs[i].close(SaveOptions.NO);
      }
      }

       

      2nd Script:

       

      Main();

      function Main() {
      var docs = app.documents;

      for (var i = docs.length-1; i >= 0; i--) {
        docs[i].close(SaveOptions.YES);
      }

      }

       

      3rd Script:

       

      var docs = app.documents;

      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;

      app.documents.everyItem().revert();

      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

       

        

      I want join them together

       

      Thank you Chinna to write a script for me, but not work

      Can someone help me to fix it?

       

      var win = new Window("palette", 'Relink Images', [0,0,195,107], );   

      with(win)   

      {   

              win.rBut1 = add( "radiobutton", [5,5,115,25], 'Don\'t Save' );   

              win.rBut2 = add( "radiobutton", [5,30,190,50], 'Save' );   

              win.rBut3 = add( "radiobutton", [5,55,75,75], 'Revert' );   

              win.but = add( "button", [110,80,180,102], 'Ok' );   

              win.but.onClick = function()   

              {   

                      if(win.rBut1.value == true)   

                      {   

                              Main();   

                          }   

                      if(win.rBut2.value == true)   

                      {   

                              Main1();   

                          }   

                      if(win.rBut3.value == true)   

                      {   

                              revert();   

                          }   

                  }   

          }   

      win.center();   

      win.show();   

         

         

      function Main()   

      {   

          var docs = app.documents;   

          for (var i = docs.length-1; i >= 0; i--)   

          {   

                docs[i].close(SaveOptions.NO);   

              }   

          }   

         

         

      function Main1()   

      {   

          var docs = app.documents;   

          for (var i = docs.length-1; i >= 0; i--)   

          {   

                docs[i].close(SaveOptions.YES);   

              }   

          }   

         

      function revert()   

      {   

              var docs = app.documents;   

              app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;   

              app.documents.everyItem().revert();   

              app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;   

          }

       

      thanks

       

      Regard

       

      VK