Copy link to clipboard
Copied
I am using After Effects and would like to made the AE Expressions script to read in text from an external .txt-file with relative path ? I used the code below but keeping on getting the error path not found:
try{ myPath = "../Grafiche/ePriceData.txt"; $.evalFile(myPath); eval(thisComp.name)[index+1];
} catch(err){ err; }
Is there a way to use relative path in AE expressions for txt file ?
Copy link to clipboard
Copied
No. Paths can only be absolute.
Mylenium
Copy link to clipboard
Copied
Thanks, the app object is not visible in global scope.
But we can see it in Extend-> Script-> Toolkit. DO you have soem ideas ?
Copy link to clipboard
Copied
I'm not really clear what you are asking. Somehow you're throwing scripts and expressions into the same pot, which makes no sense. As far as evaluating a text file in an expression goes, it requires an absolute path. It only worked with a relative path once in CS5 or so if I remeber, which actualyl was a security leak/ bug in the script engine. it should not be possible. If you use scripts to apply your expressions, nothing stops you from constructing the path at runtime using string operations and applying them as a property. Otherwise this is a no-go and since that whole thing is more or less an unsupported hack, you should definitely think of using safe alternatives, anyway.
Mylenium
Copy link to clipboard
Copied
I really don't want to miss expressions with scripts but I didn't understand clearly is it possible to call function from the script in expression or not
Copy link to clipboard
Copied
Hi NarineT,
Sorry for this issue. Did you ever find a solution? Please let us know if you have or if you still need help.
Thanks,
Kevin
Copy link to clipboard
Copied
I know this is a bit of an old thread, but I am attempting to do the same thing - pull in data from a txt file that exists in the same folder as the project file. As this will be a template that I re-use over and over with different data each time, based on MyIenium's response, I will need to construct the path at runtime using string operations. Can anyone point me towards a resource for how this would be accomplished? Thanks in advance!
Copy link to clipboard
Copied
After Effects can now read and use JSON files. This is a fairly new feature. You might look into that.