Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Check a render queue item exists or alert

  • Check a render queue item exists or alert

    Posted by John Wilkins on April 4, 2008 at 5:15 pm

    I’m using the following statement in a script to display the filename of the (1) render queue output file.

    var outputPath=app.project.renderQueue.item(1).outputModules[1].file.name.replace(/%20/g, “_”);

    output = app.project.activeItem.layers.addText(outputPath);

    Currently if the render queue item does not exist you get a script error – I would like to include a condition in the script which checks to see if the item exists and produces an alert if it doesn’t but am unsure as how to approach it.

    Any advice or direction would be greatly appreciated

    Thanks

    John

    John Wilkins replied 18 years, 1 month ago 3 Members · 5 Replies
  • 5 Replies
  • Filip Vandueren

    April 4, 2008 at 6:05 pm

    You could perhaps check for

    app.project.renderQueue.numItems>0

  • Dan Ebberts

    April 4, 2008 at 6:06 pm

    Have you tried using renderQueue.numItems ?

    Dan

  • John Wilkins

    April 4, 2008 at 11:10 pm

    Thanks guys, I’ve tried this but the problem is I’m still pretty new when it comes to the actual scripting syntax so i’m not 100% how to implement it. This is what I currently have:

    var outputPath=app.project.renderQueue.item(1).outputModules[1].file.name.replace(/%20/g, “_”);

    if(app.project.renderQueue.numItems>0)
    {
    alert(‘Add an output file!’);
    }
    else
    {
    output = app.project.activeItem.layers.addText(outputPath);
    output.name = ““;
    output.transform.position.setValue([25,450]);
    }

    However, it doesn’t seem to be functioning correctly and I still just get the same error as before.

    Any pointers would be great!

    Thanks

    John

  • Dan Ebberts

    April 5, 2008 at 12:51 am

    You just need to rearrange things a little:

    if(app.project.renderQueue.numItems>0)
    {
    var outputPath=app.project.renderQueue.item(1).outputModules[1].file.name.replace(/%20/g, “_”);
    output = app.project.activeItem.layers.addText(outputPath);
    output.name = “”;
    output.transform.position.setValue([25,450]);
    }
    else
    {
    alert(‘Add an output file!’);
    }

    Dan

  • John Wilkins

    April 5, 2008 at 12:44 pm

    Thanks very much Dan. That works perfectly.

    I’m very new to ae scripting so sometimes the syntax gets away from me. I’ve downloaded the AE Scripting Guide and now the ECMAScript Language Specification so hopefully these will help.

    Thanks again

    John

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy