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

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




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

  }          