javascript - How can I get the next paragraph after my selection in InDesign? -


i'm using adobe indesign , extendscript find keyword using app.activedocument.findgrep(), , i've got part working well. know findgrep() returns array of text objects. let's want work first result:

var result = app.activedocument.findgrep()[0]; 

how can next paragraph following result?

use indesign dom

var nextparagraph = result.paragraphs[-1].insertionpoints[-1].paragraphs[-1]; 

the indesign dom has different text objects can use address paragraphs, words, characters, or insertion points (the space between characters blinking cursor sits). group of text objects called collection. collections in indesign similar arrays, 1 significant difference can addressed using negative index (paragraphs[-1]).

result refers findgrep() result. can text object, depending on search terms.

paragraphs[-1] means last paragraph of result (paragraph a). if search result 1 word, refers word's enclosing paragraph, , collection of paragraphs has 1 element.

insertionpoints[-1] refers last insertionpoint of paragraph a. comes after paragraph mark , before first character of next paragraph (paragraph b). insertionpoint belongs both paragraph and following paragraph.

paragraphs[-1] returns last paragraph of insertionpoint, paragraph b (the next paragraph).


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -