Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Script to add Effects and change Effect properties is working sometimes only.

  • Script to add Effects and change Effect properties is working sometimes only.

    Posted by Daniel Martin on August 26, 2013 at 2:52 pm

    Hello everyone!

    I am adding an effect to a layer and change some of its effect properties with a script. However, the first time I am loading up After Effects an error message appears:

    ‘Unable to execute script at line XXX. null is not an object’. I have marked the line where this happens.

    When I close the the error message and run the script again (same instance of After Effects) it works flawlessly. No error message and the effect has been applied and its properties changed successfully. (Edit to add: I close the project after the discarding the error message.)

    I’ve double-checked the effect’s name and the name of its properties. Has anyone got any idea what I am doing wrong?

    Thank you,
    D

    myComp.openInViewer();
    myComp.layer(1).selected = true;
    app.executeCommand(app.findMenuCommandId("Linear Wipe"));

    /*
    * The next line will throw the following error message if After Effects starts for the first time:
    * "Unable to execute script at line XXX. null is not an object"
    */
    myComp.layer(1).property("Effects").property("Linear Wipe")("Feather").setValue(50);
    myComp.layer(1).property("Effects").property("Linear Wipe")("Transition Completion").setValueAtTime(startTime,100);
    myComp.layer(1).property("Effects").property("Linear Wipe")("Transition Completion").setValueAtTime( myComp.layer( footageName[j-1] ).outPoint ,0);

    Mitch Mann replied 12 years, 12 months ago 2 Members · 1 Reply
  • 1 Reply
  • Mitch Mann

    August 28, 2013 at 11:37 pm

    Hmm, no solutions, but I’ve got a couple things you could try…

    Before running the script, see if it makes any difference which window is active- Timeline, project window, comp window, etc.

    Also, try calling the open comp by activeItem instead of the comp name and see if that makes a difference.

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