when i select some text then run the code below, i can replace the two characters right before and after that selected text, but this code doesn't work if i select the text in footnotes.. how can i make it work there also?
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";
Do it using straight way:
app.selection[0].insertionPoints[-1].contents = "\uFD3E";
app.selection[0].insertionPoints[0].contents = "\uFD3F";
In case of replacing:
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";
It assumes selection is somewhere inbetween any characters (and is not just an insertionPoint...)
Jarek