title: AppleScript - What's the best way to add a line break at the end of each paragraph?
body: <p>I want to separate each paragraph with an extra line break in the italicised text below (snippet of larger document). I have two methods that fail. My first method throws an exception at the end of paragraph 2, but it successfully inserts a different character such as &quot;*&quot; at the end of each paragraph:</p>
  <p>Text:<br>
  <em>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi interdum, felis in placerat dignissim, odio mi aliquam metus, non luctus lacus erat et neque. Curabitur vitae ultrices mi. Quisque posuere erat at sagittis vestibulum. Duis pulvinar at nibh sed dictum. Etiam id lectus a nisi dapibus elementum. Morbi ac tristique turpis, at vehicula tellus. Morbi et risus ac nisl pulvinar vehicula.<br>
  Fusce mattis gravida augue, quis gravida leo scelerisque sit amet. Cras nec rutrum nisl. Sed faucibus semper purus eu commodo. Etiam mollis est magna, non pretium nulla euismod eu. Suspendisse ut lectus rutrum, tempus tellus sit amet, imperdiet orci. Maecenas congue neque sit amet leo sagittis, in bibendum risus maximus. Vestibulum ac semper nulla, in pulvinar ligula. Vestibulum vel nunc sit amet metus sodales eleifend et eu purus. Quisque dictum ultricies nulla, et euismod lectus vestibulum vel. In gravida neque sit amet nisl luctus, eu rutrum odio mollis. Sed ac odio velit.</em></p>
  <p>First method:<br></p>
  <pre><code>set my_file to (choose file with prompt &quot;Choose a text file&quot;)
  
      tell application &quot;Pages&quot;
          activate
          set my_doc to open my_file
          tell my_doc to tell the body text
              set last character of every paragraph to &quot;
      &quot;
          end tell
      end tell
  </code></pre>
  <p>My second method partly works by separating out the paragraphs but it does not insert the return character exactly at the end of each paragraph. It seems that inserting a newline character at the end of the first paragraph causes changes further down the document that throws the computer off (my guess and basic explanation).</p>
  <p>Second method <br></p>
  <pre><code>set my_file to (choose file with prompt &quot;Choose a text file&quot;)
  
      tell application &quot;Pages&quot;
          activate
          set my_doc to open my_file
          tell my_doc to tell the body text
              set (every character where it is the &quot;
      &quot;) to (return &amp; return)
          end tell
      end tell
  </code></pre>
  <p>Can you help me adjust either code to cause the desired outcome?</p>