Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 90000

Re: Re: A script third part unfunction can you fix it?

$
0
0

@Jump_Over,

that's right.

 

But the logic of this script isn't really good.

IMHO this (only quick and dirty, and not tested saving and closing) should be a little bit better:

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

//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);        //return;        } return; //edited, the return was on a wrong place before
}

function close_file(){
    for (var i = docs.length-1; i >= 0; i--) {        docs[i].close(SaveOptions.NO);        //return;        } return; //edited, the return was on a wrong place before
}

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

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


Viewing all articles
Browse latest Browse all 90000

Trending Articles



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