you could try to make an action that starts with the 3 files open (ambient beauty and outline)
and a script that opens 3 files ; does the action and continue with the next folder
I made an example-script that asks to browse to the folder with 400 subfolders
and it works only with the action with the name 'testing' and the action-set with the name "Set test"
// use it at your own risk;
#target photoshop
// select a folder;
var sourceFolder = Folder.selectDialog("Select folder");
if (sourceFolder) {
var theContent = sourceFolder.getFiles();
//alert (sourceFolder);
// iterate through;
for (var m = 1; m < theContent.length+1; m++) {
var folderName = theContent[m-1].name;
var myNewFolder = new Folder( decodeURI(theContent[m-1].path) +"/"+folderName+"/");
//open the 3 files
app.open(File(decodeURI(myNewFolder)+"/"+"ambient.tga"));
app.open(File(decodeURI(myNewFolder)+"/"+"beauty.tga"));
app.open(File(decodeURI(myNewFolder)+"/"+"outline.tga"));
//alert(m);
//
doAction( 'testing','Set test' );
//Case Sensitive Action Name, Set Name
//close all documents
while(app.documents.length > 0)
{
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
};
};