
  /////////////////////////////
  // 
  //  This code was written as an example code, modify it your needs !
  //  This code is explained in the tutorials over at [http://www.kirupa.com] look for the 'scripting' tutorials
  //  Written by mlk over at www.kirupaforum.com, post over there for help !
  //
  //  [mlkdesign@online.fr]
  //  july 2004
  //

var tempFolder = new Folder ("//PSTemp")
tempFolder.create();

var DL = documents.length;

for(a=1;a<=DL;a++){
	
	activeDocument = documents[a-1];
	var AD=activeDocument;
	var imgName= AD.name
	imgName = imgName.substr(0, imgName.length -4);
	AD.flatten();


	//saving as jpg - check out other example scripts / reference to check out other file formats
  
	saveFile = new File("//PSTemp/"+imgName+".jpg");
	saveOptions = new JPEGSaveOptions();
	saveOptions.embedColorProfile = true;
	saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
	saveOptions.matte = MatteType.NONE;
	saveOptions.quality = 12;                                                 //ranges from 0 to 12
	AD.saveAs(saveFile, saveOptions, true,Extension.LOWERCASE);
}
