ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Re: Script runs a function that doesn't exist anymore

COW Forums : Adobe After Effects Expressions

Respond to this post   •   Return to posts index   •   Read entire thread

Andrei Popa
Re: Script runs a function that doesn't exist anymore
on Feb 9, 2019 at 7:52:20 am

Once you run a script, all the variables that are global are saved in memory until you restart your engine(AE here, but could be extendscript, illustrator etc). In order to not have this problem, you need to store your variables locally. To do that, the best practice in my opinion is use this kind of code as a frame for yours:

(function myScript(thisObj){

//here you write your code


This function calls on itself, and all the variables you have are stored inside it. So when it stops running, you have no variable "leftover".
As a fun fact. You can actually use a variable from a script into another script if it is stored globally.

I hope i answered your question.

My Envato portfolio.

Posts IndexRead Thread 

Current Message Thread:

© 2019 All Rights Reserved