@joojaa gave a fantastic answer here. I used it to write the below script. I formatted it to spit out JSON with an array of paths, each an object with a pathname (the name of your path on in the layers panel) and an array of x/y points on that path.
To get exactly the right numbers to output you need to do a little bit of maths with the position of your artboard as things get offset otherwise.
I've used JSON as I wanted these numbers to be fed into some graphical javascript - but it's pretty easy to format them any way you like. The commented website is pretty useful btw:
#target illustrator
// help here
// https://illustrator-scripting-guide.readthedocs.io/jsobjref/PathItems/
var doc = app.activeDocument;
var sel = doc.selection;
var activeAB = doc.artboards[doc.artboards.getActiveArtboardIndex()]; // get active AB
var docLeft = activeAB.artboardRect[0];
var docTop = activeAB.artboardRect[1];
var file = File.saveDialog('save centers', 'center:*.txt');
file.open('w')
file.write('{"paths": [\n');
for(var i = 0; i < sel.length; i++){
if(sel[i].typename == 'PathItem'){
var obj = sel[i];
var pathLen = obj.pathPoints.length;
file.write('{\n');
file.write('"name":"' + obj.name + '","points":[\n');
for ( j = 0; j < pathLen; j++ ) {
var center = obj.pathPoints[j].anchor;
var x = parseFloat(Math.abs(docLeft)) + parseFloat(center[0].toFixed(4));
var y = docTop - center[1].toFixed(4);
file.write('['+ x + ', ' + y + ']');
if(j < pathLen - 1) {
file.write(',');
}
}
file.write(']}\n');
if(i < sel.length - 1) {
file.write(',');
}
}
}
file.write(']\n}\n');
file.close();