5 Replies Latest reply on May 6, 2009 5:06 AM by sudar1983_14

    [JS] Getting next paragraph

    Thomas Silkjaer

      I am quite used to scripting in AppleScript and currently trying to "translate" one of my scripts to JavaScript - and I am stuck.


      I search a story for paragraphs (with findGrep), and then I loop through the found paragraphs. I now need to get get an object reference of the found paragraph and after tha, the following paragraph of the story (not the following paragraph in the search results).


      Getting the found paragraph is easy:


      var first_paragraph = found_paragraphs[i].paragraphs.firstItem();


      But how can i get the next paragraph of the story?


      In AppleScript i would increase the object reference (text style range) of the found_paragraphs[i], but i dont know how to accomplish that in JS?



      Thanks in advance!