Maybe it is a stupid question, but how do you make a call to a function defined in another file? I imagine you must specify a relative path, but I couldn't find anything about it in the adobe documentation.
Thanks
function defined in another file
Moderator: Paul Tuersley
- redefinery
- Posts: 112
- Joined: April 1st, 2005, 8:16 pm
- Location: CA
- Contact:
In AE 6.5 or later, you'll need to open the file, eval() its contents, then close the file, as in:
See the render_and_email.jsx script for examples.
In AE 7, you can use the new #include directive, as in:
Jeff
Code: Select all
var myCodeFile = new File("codeFile.jsx");
myCodeFile.open("r");
eval( myCodeFile.read() );
myCodeFile.close();
In AE 7, you can use the new #include directive, as in:
Code: Select all
#include "codeFile.jsx"
Hi.
I have tried to use the codes that you have given me.
However, when I run my script, it says "Expected: (" at the line where "#include" is.
Then, I tried again with parentheses around the URI path of my jsx file. This time, the message I get was that the file or folder does not exist, even though I correctly input the absolute path of my script.
Is there another way to script a reference to an external file?
I have tried to use the codes that you have given me.
However, when I run my script, it says "Expected: (" at the line where "#include" is.
Then, I tried again with parentheses around the URI path of my jsx file. This time, the message I get was that the file or folder does not exist, even though I correctly input the absolute path of my script.
Is there another way to script a reference to an external file?
My TMNT webcomic/manga online.
http://www.obscurezodiac.com
http://www.obscurezodiac.com
Sir pirelouit found the solution for me!
My script with the "#include" code worked on his MAC, but not my poor, poor PC.
Here is what he gave me and this time, my script ran perfectly on my PC:
// @include "(path)";
My script with the "#include" code worked on his MAC, but not my poor, poor PC.

Here is what he gave me and this time, my script ran perfectly on my PC:
// @include "(path)";
My TMNT webcomic/manga online.
http://www.obscurezodiac.com
http://www.obscurezodiac.com