• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Get list of batch items in AME via extendscript

New Here ,
May 22, 2024 May 22, 2024

Copy link to clipboard

Copied

I'm working on an AME script that should work alongside an AE script. I would like to send a list of comps from AE to AME (which I'm successfully doing using `app.project.renderQueue.queueInAME(false)`) then edit the render settings for each using an AME script before starting the render.

Unfortunately, reading through the AME scripting documentation, I can't figure out how to access a list of all the batch items currently in the queue. I see that the frontend object has methods (like `frontend.addFileToBatch(...)`) which return scripting objects or events like `onItemAddedToBatch` where I can access items as they're added to the batch. But is there a way to access the items already in the queue?

It feels like a simple thing, but I just can't figure it out. Any help would be appreciated 🙂

 

Thanks!

 

Adam

 

ps - I'm open to other ideas as well (like if I can send render settings from AE with the `app.project.renderQueue.queueInAME` call or if there's a way to add multiple different comps from AE to the queue via `frontend.addCompToBatch(...)`)

TOPICS
Dynamic link , How to

Views

123

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , May 23, 2024 May 23, 2024

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

...

Votes

Translate

Translate
Adobe Employee ,
May 22, 2024 May 22, 2024

Copy link to clipboard

Copied

If you need to monitor progress and render queue, I suggest using AME for scripting and adding the AE comps. See the addCompToBatch code example.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 22, 2024 May 22, 2024

Copy link to clipboard

Copied

Thanks @EckiAME for the reply, if I'm reading the documention correctly, I don't think that will work for my case since my AE project will have multiple comps that all need to be rendered seperately. The docs for 'addCompToBatch' says 'Adds the first comp of an After Effects project' and I would want to add several comps and not necessarily the first one.

 

I don't necessarily need to monitor the progess, I just would like to access the items in the queue to edit their render settings before starting the render. I've just thought of a solution though. I think I should be able to add a listener with `frontend.addEventListener("onItemAddedToBatch", …);` which will handle the render settings and then add the needed comps via `app.project.renderQueue.queueInAME(false)` and sort it out like that. The documentation isn't really clear there though. Does the eventObj from `frontend.addEventListener("onItemAddedToBatch", …);` give access to the related EncoderWrapper object?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 23, 2024 May 23, 2024

Copy link to clipboard

Copied

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");
}




Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 24, 2024 May 24, 2024

Copy link to clipboard

Copied

LATEST

Thanks so much Suky, that's a great solution to the problem!

 

In case it's helpful to others… the comps aren't necessarily in the root of my project but I found that comps in the AE expose their dynamic link id with comp.dynamicLinkGUID.

 

Thanks again Suky!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines