try{
              // =======================================================
              var idsave = charIDToTypeID( "save" );
                  var desc17 = new ActionDescriptor();
                  var idT = charIDToTypeID( "T   " );
                      var desc18 = new ActionDescriptor();
                      var idPlt = charIDToTypeID( "Plt " );
                      var idClrP = charIDToTypeID( "ClrP" );
                      var idPerc = charIDToTypeID( "Perc" );
                      desc18.putEnumerated( idPlt, idClrP, idPerc );
                      var idClrs = charIDToTypeID( "Clrs" );
                      desc18.putInteger( idClrs, 256 );
                      var idFrcC = charIDToTypeID( "FrcC" );
                      var idFrcC = charIDToTypeID( "FrcC" );
                      var idNone = charIDToTypeID( "None" );
                      desc18.putEnumerated( idFrcC, idFrcC, idNone );
                      var idTrns = charIDToTypeID( "Trns" );
                      desc18.putBoolean( idTrns, true );
                      var idDthr = charIDToTypeID( "Dthr" );
                      var idDthr = charIDToTypeID( "Dthr" );
                      var idDfsn = charIDToTypeID( "Dfsn" );
                      desc18.putEnumerated( idDthr, idDthr, idDfsn );
                      var idDthA = charIDToTypeID( "DthA" );
                      desc18.putInteger( idDthA, 75 );
                  var idIndC = charIDToTypeID( "IndC" );
                  desc17.putObject( idT, idIndC, desc18 );
                  var idAs = charIDToTypeID( "As  " );
                      var desc19 = new ActionDescriptor();
                      var idIntr = charIDToTypeID( "Intr" );
                      desc19.putBoolean( idIntr, false );
                  var idGFFr = charIDToTypeID( "GFFr" );
                  desc17.putObject( idAs, idGFFr, desc19 );
                  var idIn = charIDToTypeID( "In  " );
                  desc17.putPath( idIn, savePath() );
                  var idDocI = charIDToTypeID( "DocI" );
                  desc17.putInteger( idDocI, 195 );
                  var idCpy = charIDToTypeID( "Cpy " );
                  desc17.putBoolean( idCpy, true );
                  var idLwCs = charIDToTypeID( "LwCs" );
                  desc17.putBoolean( idLwCs, true );
                  var idsaveStage = stringIDToTypeID( "saveStage" );
                  var idsaveStageType = stringIDToTypeID( "saveStageType" );
                  var idsaveBegin = stringIDToTypeID( "saveBegin" );
                  desc17.putEnumerated( idsaveStage, idsaveStageType, idsaveBegin );
              executeAction( idsave, desc17, DialogModes.ALL );

              // =======================================================
              var idsave = charIDToTypeID( "save" );
                  var desc20 = new ActionDescriptor();
                  var idT = charIDToTypeID( "T   " );
                      var desc21 = new ActionDescriptor();
                      var idPlt = charIDToTypeID( "Plt " );
                      var idClrP = charIDToTypeID( "ClrP" );
                      var idPerc = charIDToTypeID( "Perc" );
                      desc21.putEnumerated( idPlt, idClrP, idPerc );
                      var idClrs = charIDToTypeID( "Clrs" );
                      desc21.putInteger( idClrs, 256 );
                      var idFrcC = charIDToTypeID( "FrcC" );
                      var idFrcC = charIDToTypeID( "FrcC" );
                      var idNone = charIDToTypeID( "None" );
                      desc21.putEnumerated( idFrcC, idFrcC, idNone );
                      var idTrns = charIDToTypeID( "Trns" );
                      desc21.putBoolean( idTrns, true );
                      var idDthr = charIDToTypeID( "Dthr" );
                      var idDthr = charIDToTypeID( "Dthr" );
                      var idDfsn = charIDToTypeID( "Dfsn" );
                      desc21.putEnumerated( idDthr, idDthr, idDfsn );
                      var idDthA = charIDToTypeID( "DthA" );
                      desc21.putInteger( idDthA, 75 );
                  var idIndC = charIDToTypeID( "IndC" );
                  desc20.putObject( idT, idIndC, desc21 );
                  var idAs = charIDToTypeID( "As  " );
                      var desc22 = new ActionDescriptor();
                      var idIntr = charIDToTypeID( "Intr" );
                      desc22.putBoolean( idIntr, false );
                  var idGFFr = charIDToTypeID( "GFFr" );
                  desc20.putObject( idAs, idGFFr, desc22 );
                  var idIn = charIDToTypeID( "In  " );
                  desc20.putPath( idIn,  savePath() );
                  var idDocI = charIDToTypeID( "DocI" );
                  desc20.putInteger( idDocI, 195 );
                  var idCpy = charIDToTypeID( "Cpy " );
                  desc20.putBoolean( idCpy, true );
                  var idLwCs = charIDToTypeID( "LwCs" );
                  desc20.putBoolean( idLwCs, true );
                  var idsaveStage = stringIDToTypeID( "saveStage" );
                  var idsaveStageType = stringIDToTypeID( "saveStageType" );
                  var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
                  desc20.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
              executeAction( idsave, desc20, DialogModes.NO );
          } catch(e){}
     
          
function savePath()
  {
    
  try{
      app.activeDocument.path;
      return app.activeDocument.path;
      }catch(e){return Folder.myDocuments}

  }          