I'm completely confused by "app.documents[0].selection"and "app.activeDocument.selection[0]"
var sel = app.documents[0].selection;
alert(sel); // [object TextFrame]
alert(sel.length) // 1
When my cursor is inside the text, I tried the code below and found both are [object TextFrame], but sel.length is invalid..
It should be noted that sel is undefined.
item = app.activeDocument.selection[0];
if (item.parent.textFrames[0].constructor.name == "TextFrame") {
var sel = item.parent.textFrames[0];
}
alert(sel);//[object TextFrame]
alert(sel.length)//undefined?????
