Skip to main content
Carbonstudio
Inspiring
March 20, 2023
Question

Export to AME and start right away using JSFL from Adobe Animate

  • March 20, 2023
  • 1 reply
  • 966 views

Using some JSFL code that @JoãoCésar17023019 posted.I want to export a folder of .FLA files to Adobe Media Encoder (ame) and start the ame right away. At the moment my .jsfl sends it to the ame fine but the user has to start the queue.

 

var uri = fl.scriptURI.substr(0, fl.scriptURI.lastIndexOf('/')); // get the directory path of the currently executing script
var source = uri + "/_source";
var files = FLfile.listFolder(source + "/*.fla", "Files.");
var total = files.length;
var dom, i;

try
{
for (i = 0; i < total; i++)
{
fl.openDocument(source + "/" + files[i]);
dom = fl.getDocumentDOM();
dom.exportVideo(source + "/" + files[i].slice(0, -4) + ".mov", true, false, true, dom.timelines[0].frameCount);
dom.close(false);

// Get the path of the output file
var outputFile = source + "/" + files[i].slice(0, -4) + ".mp4";

// Add the output file to the encoding queue and start the encoding job
var queue = ame.getQueue();
var enc = queue.createEncoder("my_encoder");
enc.setSettingsPreset("H.264");
enc.setOutputFile(outputFile);
queue.queueIn(AMEFile(outputFile));
queue.startEncoding();
}
}
catch(error)
{
fl.trace(files);
fl.trace(error);
fl.trace("___________");
}

This topic has been closed for replies.

1 reply

JoãoCésar17023019
Community Expert
Community Expert
March 22, 2023

Hi.

 

Sorry for the late reply.

 

Did you manage to find a solution?

 

Please let us know.

 

Regards,

JC

Carbonstudio
Inspiring
March 22, 2023

Hey,

No i've tried a lot of things but i can't seem to figure it out, unless it's not possible? I've slimmed down the JSFL to closer to your example but this looks in a folder called 'fla' and loads everything automatically.

 

function main()
{
var uri = fl.scriptURI.substr(0, fl.scriptURI.lastIndexOf('/')) + "/fla"; // get the directory path of the 'data' folder
var files = FLfile.listFolder(uri + "/*.fla", "Files.");
var total = files.length;
var dom, i, source;

try
{
for (i = 0; i < total; i++)
{
source = uri + "/" + files[i];
fl.openDocument(source);
dom = fl.getDocumentDOM();
dom.exportVideo(source.slice(0, -4) + ".mov", true, false, true, dom.timelines[0].frameCount);
dom.close(false);
}
}
catch(error)
{
fl.trace(files);
fl.trace(error);
fl.trace("___________");
}
fl.quit(); // Close Adobe Animate after the code has finished running
}

main();

Carbonstudio
Inspiring
March 22, 2023

Just to clarify this works perfectly but i want the media encoder to start automatically. At the moment it just puts it in the queue paused.

 

I know i could auto encode the folder but this will be used on various machines and it won't be possible to set that up.