read line by line


I am sure someone might have already posted this somewhere but I havent been able to find this. For the experts this should be easy :).

I have a text that comes in two lines and i want to be able to assign variable to them individually so that I can call them when i want.

below example Work_address will have two addresses and they are separated by new line. I want to extract them and save them separately.

I really hope someone would have something cute to get me those two lines!

Thanks in advanced for your help!


set work_addresses to "address 1 
address 2"

-- I want to do this:
set add1 to line 1 of work_addresses
set add2 of line 2 of work_addresses

Hi, Riz.

set work_addresses to "address 1 
address 2"

set {add1, add2} to paragraphs of work_addresses

If there are two or more paragraphs, this sets the variables to the first two. Otherwise, of course, it errors.


That was Sweet!!

I was trying to do so many things like split and other complex stuff!

thanks again for making my life simple!