Skip to main content
Participant
December 10, 2022
Question

Preview (render) a frame while a script is running

  • December 10, 2022
  • 1 reply
  • 533 views

Hello there!

 

I'm working in a script that changes a few text layers, and I want to give the user the possibility to check each text that was changed before the script end running.

 

I tried to move the CTI (current time indicator) to positions where the changes were made, then adding an alert, to pause script (and the user check the text changes), but even with the new position of the CTI in the timeline, the new frame will not be rendered/previewed...

 

Is it possible to render/preview frames while a script is running? Or maybe stop/end the script, and then call it again automatically?

 

Bests!

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
December 11, 2022

Theoretically, it's possible, but tricky. Your script can add a function to the app object and you can use app.scheduleTask() to run that function at a specified number of milliseconds in the future. The function can do something (move the CTI, for example) and schedule itself to run again in the future. In the meantime control switches back to the AE UI so the UI will update. Tricky to set up, but very useful in some situations.

Participating Frequently
March 13, 2024

Hello!

 

I trying this solution, but I can't make it work.

Here's what I'm trying (simple test):

 

function CTI(){
try{
                var frameToMove = +1; // Amount of Frames [Positive = Forward. Negative = Backward]
                app.project.activeItem.time = app.project.activeItem.time + frameToMove;//
                alert("Test!");
        }
                catch (e){}
}
 
app.scheduleTask(CTI(), 1000, false);

 

I'm getting thsi error:

unable to call "scheduleTaks" because of paramter 1. Value is undefined.

 

Thanks!

Dan Ebberts
Community Expert
Community Expert
March 13, 2024

It would need to be more like this:

function CTI(){
  // your function here
  app.scheduleTask("app.cti();", 1000, false); // do this if you want the function to run 
every 1000 ms
}
app.cti = CTI;
app.scheduleTask("app.cti();", 1000, false); // launch function first time