try{

        var idsave = charIDToTypeID( "save" );
            var desc42 = new ActionDescriptor();
            var idAs = charIDToTypeID( "As  " );
                var desc43 = new ActionDescriptor();
                var idBytO = charIDToTypeID( "BytO" );
                var idPltf = charIDToTypeID( "Pltf" );
                var idMcnt = charIDToTypeID( "Mcnt" );
                desc43.putEnumerated( idBytO, idPltf, idMcnt );
                var idLZWC = charIDToTypeID( "LZWC" );
                desc43.putBoolean( idLZWC, true );
            var idTIFF = charIDToTypeID( "TIFF" );
            desc42.putObject( idAs, idTIFF, desc43 );
            var idIn = charIDToTypeID( "In  " );
            desc42.putPath( idIn, savePath() );
            var idDocI = charIDToTypeID( "DocI" );
            desc42.putInteger( idDocI, 195 );
            var idCpy = charIDToTypeID( "Cpy " );
            desc42.putBoolean( idCpy, true );
            var idLwCs = charIDToTypeID( "LwCs" );
            desc42.putBoolean( idLwCs, true );
            var idLyrs = charIDToTypeID( "Lyrs" );
            desc42.putBoolean( idLyrs, false );
            var idsaveStage = stringIDToTypeID( "saveStage" );
            var idsaveStageType = stringIDToTypeID( "saveStageType" );
            var idsaveBegin = stringIDToTypeID( "saveBegin" );
            desc42.putEnumerated( idsaveStage, idsaveStageType, idsaveBegin );
        executeAction( idsave, desc42, DialogModes.ALL );

        // =======================================================
        var idsave = charIDToTypeID( "save" );
            var desc44 = new ActionDescriptor();
            var idAs = charIDToTypeID( "As  " );
                var desc45 = new ActionDescriptor();
                var idBytO = charIDToTypeID( "BytO" );
                var idPltf = charIDToTypeID( "Pltf" );
                var idMcnt = charIDToTypeID( "Mcnt" );
                desc45.putEnumerated( idBytO, idPltf, idMcnt );
                var idLZWC = charIDToTypeID( "LZWC" );
                desc45.putBoolean( idLZWC, true );
            var idTIFF = charIDToTypeID( "TIFF" );
            desc44.putObject( idAs, idTIFF, desc45 );
            var idIn = charIDToTypeID( "In  " );
            desc44.putPath( idIn, savePath() );
            var idDocI = charIDToTypeID( "DocI" );
            desc44.putInteger( idDocI, 195 );
            var idCpy = charIDToTypeID( "Cpy " );
            desc44.putBoolean( idCpy, true );
            var idLwCs = charIDToTypeID( "LwCs" );
            desc44.putBoolean( idLwCs, true );
            var idLyrs = charIDToTypeID( "Lyrs" );
            desc44.putBoolean( idLyrs, false );
            var idsaveStage = stringIDToTypeID( "saveStage" );
            var idsaveStageType = stringIDToTypeID( "saveStageType" );
            var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
            desc44.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
        executeAction( idsave, desc44, DialogModes.NO );

          } catch(e){}




          
function savePath()
  {
    
  try{
      app.activeDocument.path;
      return app.activeDocument.path;
      }catch(e){return Folder.myDocuments}

  }          