Skip to main content
kevinm87730361
Inspiring
February 24, 2016
Answered

Best way to run a script from a script

  • February 24, 2016
  • 1 reply
  • 920 views

Hi everyone,

I am looking for executing a script from a After Effects script, up to now, there is aftereffects.executeScript(scriptContent) which use eval to run the script. The problem is that it uses eval so it is not really safe and it is slower. So I would like to know what is actualy used when we do File -> Script -> Run script File.

Saw in the Javascript Tool Guide CC page 168 in the section Corss-DOM API Reference.

aftereffects.executeScript(theScriptContent); // Doesn't work with a script which as comments AND the script has access to my scope

Moreover, if there is comments like /** */ or /* */ in the script I want to run, it doesn't work anymore.

So, what is the best way to run a script from a script ?

This topic has been closed for replies.
Correct answer UQg

If you want to evaluate a whole script file, you can use $.evalFile(file, timeout) - see the description in the ESTK object model viewer

To evaluate a bit of code, you can use eval, it is safe.

Xavier

1 reply

UQg
UQgCorrect answer
Legend
February 24, 2016

If you want to evaluate a whole script file, you can use $.evalFile(file, timeout) - see the description in the ESTK object model viewer

To evaluate a bit of code, you can use eval, it is safe.

Xavier

kevinm87730361
Inspiring
February 24, 2016

Does it works with comments ?

UQg
Legend
February 24, 2016

Normally, yes.