Quantcast
Viewing all articles
Browse latest Browse all 85594

Re: Re: Why the alert massage return twice on the screen?

Hmmh?

Same problem as your last thread - the logic of your script isn't really good!!!

Why you do not use the structure I showed you there: A script third part unfunction can you fix it?

 

Here is the script I've posted there (extended now with alerts)

//---------------------------------------------------------------------------------------- -------------------------------------------------------------------------------

//var mySelected = Number( app.extractLabel("mDialog") ),
  var myDialog = app.dialogs.add({name:"Colse files save \"Yes\" or \"No\"",canCancel:true});  with(myDialog){       with(dialogColumns.add()){            with(dialogRows.add()){                 var mySelection = dropdowns.add({stringList:["01   Yes", "02   No", "03   Reverse"], selectedIndex: 0});            }       }  }

if (myDialog.show() == true) {
    var docs = app.documents;    main();    myDialog.destroy();    }

function main(){
if (mySelection.selectedIndex == 0){
      //colse_file();      save_file();      return;      }
if (mySelection.selectedIndex == 1){      close_file();      return;      }
if (mySelection.selectedIndex == 2){      revert_file();      return;      }
}

function save_file(){ // colse_file()
    for (var i = docs.length-1; i >= 0; i--) {        docs[i].close(SaveOptions.YES);        alert("saved")        return;        }
}

function close_file(){
    for (var i = docs.length-1; i >= 0; i--) {        docs[i].close(SaveOptions.NO);        alert("closed")        return;        }
}

function revert_file(){
       app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;       app.documents.everyItem().revert();       app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;       alert("reversed")       return;
}

//---------------------------------------------------------------------------------------- -------------------------------------------------------------------------------

 

This should easy fix your problem.

Have fun

 


Viewing all articles
Browse latest Browse all 85594

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>