After Effects: AE Expressions Relative text file path

1.4k views Asked by At

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 ?

2

There are 2 answers

0
dazzafact On

You can call the Project Path

getPath();
function getPath(){

     var rs=thisProject.fullPath.split('\\');

    return rs.splice(0,rs.length-1).join('\\')+'';

}
0
Leif Messinger LOAF On

Edited from dazzafact's post:

That may work, but I was working on a mac at the time.

function getPath(){
    var rs=thisProject.fullPath;
    rs = rs.split('/');
    rs.pop();
    return rs.join('/')+'';
}
getPath()