function cutLines T,N
  put the length of T into L
  if  L < N then put T into R
  else
    put min(N,L) into Z
    repeat with P = Z down to 1
      if char P of T is in " ,;:>)}]-Ñ$%?/\" then exit repeat
    end repeat
    put (char 1 to P of T) & return into R
    put cutLines(char P+1 to L of T,N) after R
  end if
  return R
end cutLines