Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Naming a created Null with ExtendScript? Also, Cameras.

  • Naming a created Null with ExtendScript? Also, Cameras.

    Posted by Blake Goulette on January 15, 2011 at 6:29 pm

    There’s probably something extremely simple I’m overlooking, but I’d appreciate any advice.

    I’m new to ExtendScript, not to Javascript (well, ECMA script — I do a bunch of AS3 coding for Flash), but I’m having trouble locating a thorough reference or examples that will help clear things up. So here I am.

    I’ve tried:

    var myNull=app.newNull();
    myNull.name=”NullName”;

    but realized that my null isn’t getting named. Is there some way to name nulls so that the names appear in a comp once the script has run? It seems like there must be, but it escapes me.

    Also, cameras: creating a camera is straightforward enough, but how should I be adding/specifying properties like zoom, focal length, depthOfField, blurLevel, etc?

    I apologize for the noob-ness of this post, but I’m at my wits’ end! Thanks for any advice!

    Dan Ebberts replied 15 years, 4 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    January 15, 2011 at 7:12 pm

    Assuming you have the comp selected, this should work:

    {
    var myNull=app.project.activeItem.layers.addNull();
    myNull.name=”NullName”;
    }

    Dan

  • Blake Goulette

    January 15, 2011 at 8:42 pm

    Dan, thanks for the fast response!

    That’s effectively what I’ve been trying (since my original post):

    var comp=app.project.activeItem;
    var myNull=comp.layers.addNull();
    myNull.name=”My Null Name”;

    but it still shows up as, say, “Null 1” in the timeline. Wait…

    Okay, I’m an idiot. Instead of showing Layer name in the comp, it was showing Source name. Is there any way to programmatically switch between displaying Source names and Layer names? Or will I just have to remember to switch it manually?

  • Dan Ebberts

    January 15, 2011 at 9:40 pm

    Scripting doesn’t have much control over the UI. You’ll have to remember to do it manually.

    Dan

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