0 Replies Latest reply on Aug 1, 2014 1:54 PM by Teetan VK

    Can you INTERACT with script without mouse on click?

    Teetan VK Level 1

      Hi everyone,

       

      I got this script

      has a dropdown list inside

      I can run it in win 7 and interact with by keyboard without mouse

       

      but why I can't do same thing in the MAC?

       

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

      var
        mySelected = Number( app.extractLabel("mDialog") ),
        myDialog = app.dialogs.add({name:"Indesign Close and Save File Machine",canCancel:true});
        with(myDialog){
             with(dialogColumns.add()){
                  with(dialogRows.add()){
                       var
                       mySelection = dropdowns.add({stringList:["01   Close and SAVED", "02   Close WITHOUT save", "03   Save all files", "04   Reverse", "05   Remove unused color"], selectedIndex: 0});
           }
                  }
             }


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

      function main(){
            colse_file();
      }

      function colse_file(){
          if (mySelection.selectedIndex == 0){
              var docs = app.documents;
                   for (var i = docs.length-1; i >= 0; i--) {
                           docs[i].close(SaveOptions.YES);
                    }
            alert("Files are saved.") 
            return;
                }
      //---------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
          if (mySelection.selectedIndex == 1){
              var docs = app.documents;
              for (var i = docs.length-1; i >= 0; i--) {
                    docs[i].close(SaveOptions.NO);
                    }
            alert("Files are closed without save.") 
            return;
              }
      //---------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------

         if (mySelection.selectedIndex == 2){

              var docs = app.documents;
                   for (var i = docs.length-1; i >= 0; i--) {
                           docs[i].save();
                    }
            alert("Files are saved.") 
            return;
           }

      //---------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
         if (mySelection.selectedIndex == 3){
            var docs = app.documents;
                   app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
                   app.documents.everyItem().revert();
                   app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
            alert("All files are reversed.") 
            return;
                  }

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

         if (mySelection.selectedIndex == 4){
            var doc = app.documents, i, j; 
                 for(i =0;i<doc.length;i++) 
                     { 
                        unused = doc[i].unusedSwatches; 
                           for(j=0;j<unused.length;j++) 
                      { 
                            unused[j].remove(); 
                             } 
                         } 
              alert("All the unused swatches in your opening files are removed.") 
            return;
                  }
              }

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

       

      thanks

       

      Teetan