try{
    // =======================================================
    var idsave = charIDToTypeID( "save" );
        var desc9 = new ActionDescriptor();
        var idAs = charIDToTypeID( "As  " );
            var desc10 = new ActionDescriptor();
        var idPhteight = charIDToTypeID( "Pht8" );
        desc9.putObject( idAs, idPhteight, desc10 );
        var idIn = charIDToTypeID( "In  " );
        desc9.putPath( idIn, savePath() );
        var idDocI = charIDToTypeID( "DocI" );
        desc9.putInteger( idDocI, 195 );
        var idLwCs = charIDToTypeID( "LwCs" );
        desc9.putBoolean( idLwCs, true );
        var idsaveStage = stringIDToTypeID( "saveStage" );
        var idsaveStageType = stringIDToTypeID( "saveStageType" );
        var idsaveBegin = stringIDToTypeID( "saveBegin" );
        desc9.putEnumerated( idsaveStage, idsaveStageType, idsaveBegin );
    executeAction( idsave, desc9, DialogModes.ALL );

    // =======================================================
    var idsave = charIDToTypeID( "save" );
        var desc11 = new ActionDescriptor();
        var idAs = charIDToTypeID( "As  " );
            var desc12 = new ActionDescriptor();
        var idPhteight = charIDToTypeID( "Pht8" );
        desc11.putObject( idAs, idPhteight, desc12 );
        var idIn = charIDToTypeID( "In  " );
        desc11.putPath( idIn, savePath() );
        var idDocI = charIDToTypeID( "DocI" );
        desc11.putInteger( idDocI, 195 );
        var idLwCs = charIDToTypeID( "LwCs" );
        desc11.putBoolean( idLwCs, true );
        var idsaveStage = stringIDToTypeID( "saveStage" );
        var idsaveStageType = stringIDToTypeID( "saveStageType" );
        var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
        desc11.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
    executeAction( idsave, desc11, DialogModes.NO );
          } catch(e){}



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

  }          