我正在尝试使用 ExtendScript 编写 InDesign 脚本。我希望脚本剪切选定的文本,插入脚注并将文本粘贴到脚注正文中。我试过的:
function makeFootnoteOfSelection(){
var fnText = app.activeDocument.selection[0];
// this should actually clone the selected text, not reference it, because the next statement zaps it from memory
app.activeDocument.selection[0].remove(); // works
var fNote = app.activeDocument.selection[0].footnotes.add(); // works, adds an empty footnote with a reference
fNote.contents = fnText.contents;
// this replaces the reference number, I was hoping to retain it and just add the text
// fNote.contents += fnText.contents; also replaces the reference number
}