0 Replies Latest reply on Jul 19, 2013 4:37 AM by davidDav

    Multiple files not saved and close

    davidDav Level 1

      Hi Forum,

       

      I am trying to save and close multiple files (IDML to INDD), my script is doing only opening multiple files

      here is my script, can any one help me on this please...

      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALERTS

       

      var mySourceFolder = Folder('/Volumes/User/Desktop/IDML');

      if(mySourceFolder != null){

      var myDocuments = mySourceFolder.getFiles("*.idml","*.IDML"); 

       

      if(myDocuments.length > 0){  

      for(myCounter = 0;myCounter < myDocuments.length; myCounter++){  

      var myDocument = app.open(myDocuments[myCounter]);

      }

      }}

       

      var myDoc = app.activeDocument;

      for ( i = myFiles.length-1; i >= 0 ; i-- ){

      var myDoc = app.activeDocument[i].save(File(Folder('/Volumes/User/Desktop/CS4')+ "/" + app.activeDocument.name + '.indd'), true);

      app.activeDocument[i].close(SaveOptions.yes);

      }

       

      var myFolder = Folder('/Volumes/User/Desktop/IDML');

      var myFiles = myFolder.getFiles( "*.idml" );

      for ( i = myFiles.length-1; i >= 0 ; i-- ){

      myFiles[i].remove();

      }

      Thanks,

      David