在Indesign中插入脚注中的字符

时间:2016-12-24 08:27:21

标签: javascript adobe-indesign

当我选择一些文本然后运行下面的代码时,我可以在所选文本之前和之后替换两个字符,但如果我在脚注中选择文本,则此代码不起作用..如何使其工作还有?

var myStory = app.selection[0].parentStory;
var myIndex = app.selection[0].index;
var myInS = app.selection[0].insertionPoints[0].index;

var toplam = app.selection[0].characters.length
var toplama = app.selection[0].insertionPoints.length;

var myText1 = myStory.characters[myIndex-1];
var myText2 = myStory.characters[myIndex+toplam+0];

myText1.contents = "\uFD3F";  
myText2.contents = "\uFD3E";  

1 个答案:

答案 0 :(得分:1)

直接使用:

    app.selection[0].insertionPoints[-1].contents = "\uFD3E";
    app.selection[0].insertionPoints[0].contents = "\uFD3F";

如果要更换:

    var 
    myParent = app.selection[0].parent,
    char1 = myParent.characters[app.selection[0].characters[0].index - 1],
    char2 = myParent.characters[app.selection[0].characters[-1].index + 1];

    char2.contents = "\uFD3E";
    char1.contents = "\uFD3F";

它假设选择介于任何字符之间(并且不仅仅是插入点...)

亚雷克