You could try this script, it prompts for the folder where the files are, creates a folder off this called Processed where the tif file are saved.
#target photoshop;
app.bringToFront();
main();
function main(){
var selectedFolder = Folder.selectDialog("Please select the folder to process");
if(selectedFolder == null ) return;
var outFolder = Folder(selectedFolder + "/processed");
if(!outFolder.exists) outFolder.create();
var threeFiles = new Array();
var PictureFiles = selectedFolder.getFiles(/\.(jpg|jpe|dng|bmp|tif|tiff|psd|crw|cr2|exr|pcx|nef|dcr|dc2|erf|raf|orf|tga|mos|pef|png)$/i);
while(PictureFiles.length>2){
for(var a = 0;a<3;a++){threeFiles.push(PictureFiles.shift());}
stackFiles(threeFiles);
selectAllLayers();
autoAlign();
autoBlendLayers();
var layerName = activeDocument.activeLayer.name.replace(/\....$/i,'');
var saveFile = new File(outFolder+ '/' + layerName + '.psd');
SaveTIFF(saveFile);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
threeFiles=[];
}
};
function autoBlendLayers(){
var d=new ActionDescriptor();
d.putEnumerated(stringIDToTypeID("apply"), stringIDToTypeID("autoBlendType"), stringIDToTypeID("maxDOF"));
d.putBoolean(stringIDToTypeID("colorCorrection"), true);
d.putBoolean(stringIDToTypeID("autoTransparencyFill"), false);
executeAction(stringIDToTypeID("mergeAlignedLayers"), d, DialogModes.NO);
};
function SaveTIFF(saveFile){
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.embedColorProfile = true;
tiffSaveOptions.alphaChannels = true;
tiffSaveOptions.layers = true;
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;
activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);
};
function selectAllLayers() {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
desc.putReference( charIDToTypeID('null'), ref );
executeAction( stringIDToTypeID('selectAllLayers'), desc, DialogModes.NO );
};
function stackFiles(sFiles){
var loadLayersFromScript = true;
var SCRIPTS_FOLDER = decodeURI(app.path + '/' + localize('$$$/ScriptingSupport/InstalledScripts=Presets/Scripts'));
$.evalFile( new File(SCRIPTS_FOLDER + '/Load Files into Stack.jsx'));
loadLayers.intoStack(sFiles);
};
function autoAlign() {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
desc.putReference( charIDToTypeID('null'), ref );
desc.putEnumerated( charIDToTypeID('Usng'), charIDToTypeID('ADSt'), stringIDToTypeID('ADSContent') );
desc.putEnumerated( charIDToTypeID('Aply'), stringIDToTypeID('projection'), charIDToTypeID('Auto') );
desc.putBoolean( stringIDToTypeID('vignette'), false );
desc.putBoolean( stringIDToTypeID('radialDistort'), false );
executeAction( charIDToTypeID('Algn'), desc, DialogModes.NO );
};
function autoBlend() {
var desc = new ActionDescriptor();
desc.putEnumerated( charIDToTypeID('Aply'), stringIDToTypeID('autoBlendType'), stringIDToTypeID('maxDOF') );
desc.putBoolean( charIDToTypeID('ClrC'), true );
executeAction( stringIDToTypeID('mergeAlignedLayers'), desc, DialogModes.NO );
};