Hi, here is Suky from the AME Team as well.
You may want to use the scripting API addDLToBatch(). Before calling this method you can get all the GUID's (using
var result = frontend.getDLItemsAtRoot(projectPath); // returns a list )
from your compositions and just pass them in a loop, that will ensure that you can add all your compositions to the batch.
addDLToBatch() returns an EncoderWrapper Obj which is basically the BatchItem and here https://ame-scripting.docsforadobe.dev/reference/index.html#encoderwrapper
you can see which methods it provides to manipute a batch item.
The events basically have either booleans or strings that gives you a success=true oder strings like "done" etc.
Reach out to me if you need more help.
// The projectPath can be a path to an AfterEffects, Premiere Pro or Character Animator project
var format = "H.264";
var projectPath = "C:\\testdata\\aeCompTest.aep";
var preset = "C:\\testdata\\HighQuality720HD.epr";
var destination = "C:\\testdata\\outputFolder";
// //sources for mac
// var projectPath = "/Users/Shared/testdata/aeCompTest.aep"
// var preset = "/Users/Shared/testdata/HighQuality720HD.epr";
// var destination = "/Users/Shared/testdata/outputFolder";
var frontend = app.getFrontend();
if (frontend) {
// first we need the guid of the e.g. ae comps or ppro sequences
var result = frontend.getDLItemsAtRoot(projectPath);
$.writeln(result.length + " comps / sequences found.");
// import e.g. the first comp / sequence
if (result.length > 0) {
// listen for batch item added / creation failed event
frontend.addEventListener("onItemAddedToBatch", function (eventObj) {
$.writeln("frontend.onItemAddedToBatch: success");
});
frontend.addEventListener("onBatchItemCreationFailed", function (eventObj) {
$.writeln("frontend.onBatchItemCreationFailed: failed");
$.writeln("srcFilePath: " + eventObj.srcFilePath);
$.writeln("error: " + eventObj.error);
});
var encoderWrapper = frontend.addDLToBatch(
projectPath,
format,
preset,
result[0],
destination
);
if (encoderWrapper) {
$.writeln(
"Batch item added successfully for comp / sequence guid: ",
result[0]
);
// listen for encode progress and encode finish events
encoderWrapper.addEventListener("onEncodeProgress", function (eventObj) {
$.writeln("Encoding progress for batch item: " + eventObj.result);
});
encoderWrapper.addEventListener("onEncodeFinished", function (eventObj) {
$.writeln("Encoding result for batch item: " + eventObj.result);
});
// get encoder host to run batch
var encoderHost = app.getEncoderHost();
if (encoderHost) {
encoderHost.runBatch();
} else {
$.writeln("encoderHost not valid");
}
} else {
$.writeln("encoderWrapper not valid");
}
} else {
$.writeln("the project doesn't have any comps / sequences");
}
} else {
$.writeln("frontend not valid");
}