
function getOpenPaths() {
    
    var documentPaths = []
    
    acorn.allDocuments().forEach((doc, index) => {
        
        // doc is a NSDocument subclass
        // fileURL will be null if the file is not saved yet.
        if (doc.fileURL() != null) {
            documentPaths.push(doc.fileURL().path())
        }
    });
    
    return documentPaths;
}

print(JSON.stringify(getOpenPaths(), null, 2));
