@rob day
I'm not quite sure how to copy it to Document Fonts.
Also, after copying, will it be possible to avoid restarting InDesign multiple times?
I'm not quite sure how to copy it to Document Fonts.
This copies the local document fonts, so now you have at least 2 local copies of the same font.
var doc = app.activeDocument;
//get the document fonts as an array
var f = doc.fonts.everyItem().getElements();
//make a folder on the desktop
var pf = Folder(doc.filePath + "/Document Fonts");
if (!pf.exists) {
pf.create();
}
//loop through all the document fonts
var fp, nf;
for (var i = 0; i < f.length; i++){
//check if the font is locally installed (not substituted) and is not added from Adobe Fonts
if (f[i].status == FontStatus.INSTALLED && f[i].location != "Added from Adobe Fonts") {
fp = f[i].location
//returns the font’s local file path
nf = File(fp)
//copy the font to the destination folder
nf.copy(pf + "/" + nf.name)
}
}