Skip to main content
YuK1_Works
Inspiring
September 4, 2023
Question

What can be done to app.scheduleTask() while the modal dialog is waiting for a response.

  • September 4, 2023
  • 3 replies
  • 609 views

I am writing a jsx script.
This script uses app.scheduleTask to display a clock that updates every second.
When I close the project or while waiting for a modal dialog to close due to an error in another script, if I get an update to this script, I get "After Effects error: Can not run a script while a modal dialog is waiting for response." and the script will stop completely.

Is there any way to work around this?

This topic has been closed for replies.

3 replies

Justin Taylor-Hyper Brew
Community Expert
Community Expert
September 4, 2023

What are you trying to do in the background? The iidea is you wait for the modal to be complete before doing other stuff. Due to ExtendScript limitations there usually isn't a way around this unless you have a CEP panel and your task can be offloaded to the JS side.

Community Expert
September 4, 2023

yeah... i've encountered a similar problem trying to do some operations on odle calls while a modal is open...

you could try to re-schedule the task in the catch block.

function timer_func() {

    try{update()}

    catch(e){app.scheduleTask("timer_func()", 1000, true);}

}

app.scheduleTask("timer_func()", 1000, true);

YuK1_Works
Inspiring
September 4, 2023

Thanks.
But that method didn't seem to work.
The exception was happening in a scope outside of timer_func, and I couldn't catch it inside timer_func.

YuK1_Works
Inspiring
September 4, 2023

I guess I was wrong about the sample code and its effect, and about the suppression of the display of errors.