Home » Скриптинг

Как программно выделить весь абзац, в котором стоит курсор?

11 Март 2009 No Comment

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//DESCRIPTION: Select current paragraph
//  (c) Dave Sanders
if (app.documents.length > 0 &&
    app.selection.length == 1 &&
        app.selection[0].hasOwnProperty("baseline")) {
    selectPara(app.selection[0]);
}
 
function selectPara(myText) {
    try {
        app.select(myText.paragraphs[0]);
    } catch(e) {
        // selection is last insertion point of story after a return
        try {
            app.select(myText.parent.paragraphs[-1]);
        } catch(e) {} // story contains just one insertion point
    }
}

Leave your response!

You must be logged in to post a comment.