Thank you, Dan.
For some reason, I still got an “directory does not exist” error when trying
myFootage.mainSource.path;
However I managed to solve it temporarily using file name substrings.
This is not ideal, because I can only use it on this project, but if there is a way to make it not dependent on substrings, I am all ears.
—-
Also, why I had to set second item (2) for “myFootage” is beyond me, because in the project bin the footage is clearly first from top. But this is the only way I got the script to run. Weird.
var myComp = app.project.activeItem;
var myFootage = app.project.item(2);
var myFolder = myFootage.mainSource.file;
var myLoc = myFolder.path.substring(0,49);
var rq = app.project.renderQueue;
var render = rq.items.add(myComp);
render.outputModules[1].file = new File(myLoc + "/" + myComp.name + ".mp4");
app.project.renderQueue.render()