3 Replies Latest reply on Dec 18, 2017 7:30 AM by Dhal_Naka

    How to check if cancel has been pressed in a save dialog window

    Dhal_Naka Level 1

      Hi everyone!

      I have a problem that I don't know how to solve. My script gives you the possibility to save a file manually using a Save Dialog window, but I don't know how to check if save or cancel have been pressed so the script stops. This is the code

       

                      var dskTop = (outputPath + "/assets/assets_data/");   
                      var dskPth = String(dskTop);
                      var newSpot = new File(dskPth+"/exporting_name");
                      myFilePath = newSpot.saveDlg('Select Destination Folder', '*.js'); 
                      
                      //HOW COULD I CHECK IF CANCEL HAS BEEN PRESSED?
      
      
                      myFile = new File(myFilePath);
                      
                      // SO THIS FUNTON DOESNT START
                      exportInfoFunction();
                      
                      //we check if the has been any error in the "exportInfoFunction" function
                      if (theresAnError == 0){
                          if (myFile.exists){
                              alert("The file has been successfully exported");
                          }
                      }
      

       

      Thanks!