Hello again,
I used the script on another document and Frame crashed. Use the script with care. I guess the text selection is not exactly right or the end of the loop is a little buggy. But the main part of the script works. If I find the error later, I will post it here.
Ciao
Jang