How to put paragraphs in a list without the return character

Progressing well with my do-it-yourself Applescript course! This is so much fun!
i gave myself the following assignment:

I’m writing a script that grabs a list of url’s (one url per line) from a textedit document and then opens Safari, creates tab and opens the urls in these tabs.

--put the urls in a list: thelist
tell document 1 of application "TextEdit"
	copy every paragraph to thelist
end tell

tell application "Safari" to activate
tell application "System Events"
	tell process "Safari"
		repeat with myurl in thelist
			--Dutch Safari: tabs are created perfectly! I love UIScripting!
			click menu item "Nieuw tabblad" of menu "Archief" of menu bar 1
			set mijnurl to contents of myurl as text
			--the next line goes wrong because thelist also contains return characters
			open location mijnurl
		end repeat
	end tell
end tell

Everything works very well, except for the Returns.
I could code some textmanipulation to strip the Returns out, but maybe there is a simpeler way, like “copy every paragraph to thelist without delimeters”
(obviously this doesn’t work, but maybe you have suggestions?)

I don’t know how to do a “copy every paragraph to thelist without delimeters” either, but you can set theText to text (of document 1 of application “TextEdit”), set applescript’s text item delmiters to “r” (return), and set theList to text items of theText as List. That’s the usual way of parsing delimitted text blocks.

It would be even simpler to insert a single line…

 set myURL to characters 1 through -1 of myURL

right after the “repeat with myURL in thelist” line.

The “characters 1 through -1 of” Returns everything but the last character.

Glad you’re having fun with AS!

Works well! Thanks!

Nassty tricksy things, Gollum…

Where did you learn this? Or how do you think of it? characters 1 through -1
That is cool!

Thanks to people like you!