Answered
Setting FN settings across multiple files
Is there a way to set FN settings across multiple files or all the files in a book? There certain things that synching styles will not cover.
Thanks
SF
Is there a way to set FN settings across multiple files or all the files in a book? There certain things that synching styles will not cover.
Thanks
SF
Hi @SuzzyFlamingo it's actually pretty easy via a script, and I have just written one. See if it works for you.
- Mark
/**
* @file Synchonize Footnote Options.js
*
* Synchronizes all open documents to match the active document.
*
* @author m1b
* @version 2025-08-26
* @discussion https://community.adobe.com/t5/indesign-discussions/setting-fn-settings-across-multiple-files/m-p/15474862
*/
function main() {
var settings = {
doc: app.activeDocument,
activeDocumentID: app.activeDocument.fullName,
docIDs: undefined,
synchType: 'footnoteOptions',
showUI: true,
};
settings.docIDs = getProperties(app.documents, 'fullName');
if (settings.showUI) {
var result = ui(settings);
if (2 === result)
// user cancelled
return;
}
if (!app.activeDocument.hasOwnProperty(settings.synchType))
throw new Error('Synchronize failed: bad `synchType` (' + settings.synchType + ')');
var activeSynchOptions = app.activeDocument[settings.synchType].properties;
for (var i = 0, doc; i < settings.docIDs.length; i++) {
doc = getDocumentByPath(app.documents, settings.docIDs[i]);
app.activeDocument = doc;
doc[settings.synchType].properties = activeSynchOptions;
}
app.activeDocument = getDocumentByPath(app.documents, settings.activeDocumentID);
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Synchronize Options');
/**
* Returns a document with matching path.
* @author m1b
* @version 2024-04-21
* @param {Array<Document>|Documents} docs - the documents to look through.
* @param {File|String} [path] - the path to search for.
* @returns {Document?} - the Document, if found.
*/
function getDocumentByPath(docs, path) {
path = String(path);
for (var i = 0; i < docs.length; i++) {
if (
docs[i].saved
&& path === String(docs[i].fullName)
)
return docs[i];
}
};
/**
* Returns a property of each object.
* @author m1b
* @version 2023-09-08
* @param {Array|Collection} things - the things to look through.
* @param {String} key - the property name.
* @param {*} value - the value to match.
* @returns {Array<*>}
*/
function getProperties(things, key) {
var found = [];
for (var i = 0; i < things.length; i++) {
try {
if (things[i].hasOwnProperty(key))
found.push(things[i][key]);
} catch (_) { }
}
if (found.length > 0)
return found;
};
/**
* Shows UI for Synchronize Footnotes/Endnotes script.
* @param {Object} settings - the settings to adjust.
* @returns {1|2} - result code
*/
function ui(settings) {
var w = new Window("dialog", 'Synchronize Footnotes/Endnotes', undefined, { closeButton: false }),
// radio button
sycnhTypeGroup = w.add('group {orientation:"row", alignment:["fill","center"], alignChildren:["left","center"], margins:[20,20,20,20] }'),
marginGroup = sycnhTypeGroup.add('group {orientation:"row", alignment:["center","center"], margins:[0,0,0,5]}'),
sortPreferenceLabel = marginGroup.add('statictext { text:"Synchronize All Open Documents:", alignment:["left","center"] }'),
footnotesRadio = sycnhTypeGroup.add('radiobutton {text:"Footnotes"}'),
endnotesRadio = sycnhTypeGroup.add('radiobutton {text:"Endnotes"}'),
// buttons
bottomUI = w.add("group {orientation:'row', alignment:['fill','top'], margins: [0,0,0,0] }"),
buttons = bottomUI.add("group {orientation:'row', alignment:['right','top'], alignChildren:'right' }"),
cancelButton = buttons.add('button', undefined, 'Cancel', { name: 'cancel' }),
synchButton = buttons.add('button', undefined, 'Synchronize', { name: 'ok' });
// initialize
footnotesRadio.value = 'footnoteOptions' === settings.synchType;
endnotesRadio.value = 'endnoteOptions' === settings.synchType;
// event handling
synchButton.onClick = function () {
settings.synchType = footnotesRadio.value ? 'footnoteOptions' : 'endnoteOptions';
w.close(1);
};
w.center();
return w.show();
};
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.