Copy link to clipboard
Copied
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!
Stupid me.... Just checking if myFilePath == null does it. If you press cancel you don't get this data so enough for me to stop the script and don't execute the function
Copy link to clipboard
Copied
You can only check such stuff by creating your own dialogs. The system dialogs are modal and don't return any info beyond having been opened or closed. The scripts have no idea what a system file dialog actually does. it could contain a hundred buttons and you wouldn't know which ones were pressed.
Mylenium
Copy link to clipboard
Copied
Thanks for the reply!!
Copy link to clipboard
Copied
Stupid me.... Just checking if myFilePath == null does it. If you press cancel you don't get this data so enough for me to stop the script and don't execute the function