• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Wait until after effect is loaded before running the script

Community Beginner ,
Jun 09, 2022 Jun 09, 2022

Copy link to clipboard

Copied

Hello, here is my issue:
I run an after effect script with the command line (the script goes through all the elements of the project). It works well when an after effect window is already launched. However if no after effect window is opened a bug appears explaining that it does not find some elements. I think that my script is executed before the complete launch of after effect and it does not find all the elements of the project. If I close the window that displays the error and I restart the same script without changing anything it works the second time because the after effect window is open.

How can I wait until after effect is fully loaded?
I tried .sleep() but it's blocking, it doesn't load the window it waits for the end of the sleep.
Thanks in advance

TOPICS
Scripting

Views

132

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 09, 2022 Jun 09, 2022

Copy link to clipboard

Copied

LATEST

One hack that might work, depending on your situation, would be to enclose your script in a function wrapper, add it to the app object, and schedule it to run in say, 5 seconds (5000 milliseconds). Not particularly good form, but it might work for your purposes. It would look something like this:

function YourScript(){
	//
	// your script goes here
	//
}
app.yourScript = YourScript;
app.scheduleTask("app.yourScript();",5000,false);

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines