Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change a compositions workAreaStart and workAreaDuration with Expressions or loading .jsx-files with Expressions

  • Change a compositions workAreaStart and workAreaDuration with Expressions or loading .jsx-files with Expressions

    Posted by Martin Bollerup on October 24, 2012 at 1:13 pm

    Hey there,

    Im looking for a way to dynamically change the length of a compositions workarea according to the footage contained within.

    This can be done with Extended Script, but I cannot use .jsx-files placed in the scripts/startup folder because the script is executed before the composition is loaded and therefore I haven’t got any footage length to measure. Neither can I use the shutdown-folder because these scripts are executed when the project is closed…

    So I think that leaves me with two possibilities:

    1) Change the length of the composition with Expressions?
    2) Find a way to run a Extended Script file when the project is loaded and the footage has been replaced?

    Best Regards,
    Martin

    // is there a way to make this happen with Expressions??
    var myComp = app.project.item(1);
    var startTime = 0;
    var duration = 30;
    myComp.workAreaStart = startTime;
    myComp.workAreaDuration = duration;

    Martin Bollerup replied 13 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 24, 2012 at 4:26 pm

    You can’t do it with expressions.

    I think the best you could do would be to create a little floating palette jsx with a button (which you could put in the startup folder), but you’d have to click the button whenever you need the update to happen.

    Dan

  • Martin Bollerup

    October 25, 2012 at 8:13 am

    Thanks for your reply Dan!

    Well I found a little workaround for my problem:

    I’m using the startup script to schedule a task with a delay of 1 second. The breakFree bool is used because somehow the script continues to run…

    This enables the project to get loaded and the script to replace footage and trim the comps – in my little sandbox environment…

    In the real world there is a virtual machine opening an After Effects document, replacing some footage and right after that starting a Render Cue… My script won’t even get run – it seems like it’s thrown to the back of the task cue… I also tried with a delay of 0.001 second – works fine in the sandbox, but still won’t get run before the Render Queue.

    If I just make an alert box in the startup scripts it’ll be shown before the project is loaded. So it’s not that the virtual machine ignores the startup scripts, but something about the queuing of tasks?

    So has anyone got any experience with pausing render queues, altering content, starting again or as I probably have to; stop a render cue, copy the names of the export files (so the servers won’t freak out), make the changes in duration etc., make a new render queue with the proper names…

    Any thoughts?

    cheers,
    Martin

    var breakFree = false;
    function runOnStartUp(){

    if (!breakFree){
    breakFree = true;
    replaceFootage();
    trimAndPositionLayers();
    }

    }

    if( ! app.project ) {
    alert("no project");
    } else {
    app.scheduleTask("runOnStartUp()", 1000, 1);
    }

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