title: Trying to read from one Praat TextGrid and write to a new Praat TextGrid - Error on Inserting the interval into the new TextGrid
body: <p>I'm trying to read from one TextGrid modify the text and put that 
   text into an interval of a new TextGrid.  I'm getting an error when I try to insert it into the new TextGrid.  I'm looking for certain text marked by the <code>&lt;s/&gt;</code> and <code>&lt;/s&gt;</code>.  And that is what I want to write to the new TextGrid.</p>
  
  <pre><code>Open long sound file... /Summer_recap.wav
  To TextGrid... "word"
  
  textGridToWriteTo$ = "Summer_recap"
  textGridToReadFrom$ = "Summer_recap_old"
  tGrid = Read from file: "Summer_recap_old.TextGrid"
  numberOfIntervals = Get number of intervals: 1
  for intervalNumber from 1 to numberOfIntervals
     text$ = Get label of interval: 1, intervalNumber
     if text$ &lt;&gt; ""
        head$ = left$ (text$, 4)
        tail$ = right$ (text$, 4)
        if head$ = "&lt;s/&gt;" and tail$ = "&lt;/s&gt;"
           startTime = Get start point: 1, intervalNumber
           endTime = Get end point: 1, intervalNumber
           s$ = replace$ (text$, "&lt;s/&gt;", "", 1)
           s$ = replace$ (s$, "&lt;/s&gt;", "", 1)
           select TextGrid 'textGridToWriteTo$'
           Insert boundary... 1 startTime
  
           # below is where the error occurs
           Set interval text... 1 'test$'
  
           Insert boundary... 1 endTime
           select TextGrid 'textGridToReadFrom$'
        endif
    endfor
  </code></pre>