Search code examples
adobeextendscriptafter-effects

Is there a way to moving playhead/current time in After Effects?


In short, I need to reset the playhead back to frame 1 at the time of the script running.

I'm creating a script for exporting a handful comps after updating some text. One export will be a jpg, and then 2 short videos. I am using app.executeCommand(2104) which is Save Frame As to add the current frame to the render queue for the jpg export. Otherwise, AE would be trying to export a jpg sequence even if only 1 frame long. This affects the output name and the settings of the export. I haven't found an easy way of avoiding the added formatting.

I will be giving this to inexperienced coworkers, who will surely forget to reset the playhead before hitting my export button. So I was trying to force the playhead back to the beginning within the script.

Export Changes

I have tried updating the output render settings with a Time Span Start and Time Span Duration but that changed it back into the jpg sequence.

I thought I could trick/hack it by creating a new comp and then deleting. since when doing it by hand it moves the playhead to zero of the newly created comp. however, when changing focus back to the JPG comp the playhead jumped back to where it was originally.

I have searched through both of the official Adobe guides for scripting and the usual net forums but I haven't found a single command that works for moving the playhead other than by hand. I'm hoping I just missed something obvious.


Solution

  • The playhead-time-thingy-line is called the CTI (Current Time Indicator) in AE-Land. So this should work.

    app.project.activeItem.time = 0;
    

    (How) can I move the CTI from within a script?