Noob question - "can't get every line of <variable>"

I feel really stupid. I have this script…


on open (this_item)
	open for access this_item
	set fileContents to (read this_item)
	close access this_item
	set numberOfLines to the number of lines in fileContents
	repeat with i from 1 to numberOfLines
		-- do something
	end repeat
end open

and when I drag a simple text file to this script, Script Editor reports: “can’t get every line of ”

Why is that?!?!

Hi,

use paragraph instead


.
	set numberOfLines to the number of paragraphs in fileContents
.
end open

Thank you for the fast reply Stefan, that works great!