Hi Ben,

That's very easy to do via Ruby

1. Create file object using the following code
input_file = File.open("data.txt", "r")

2. There are many ways to iterate through the file or read data from the 
file depending on what you need to do.

To go through the file line-by-line it would be

input_file.each_line{|line|
line = line.chop()
     ....
     ....
     ....
}

3. Then close the handle when you are done
input_file.close()

Hope that helps.

Steve

----- Original Message ----- 
From: "Torres, Ben (HQP)" <[EMAIL PROTECTED]>
To: <wtr-general@rubyforge.org>
Sent: Tuesday, January 10, 2006 4:38 PM
Subject: [Wtr-general] Read In from external file


> Hello,
>
> Can Watir read from an external file and plug that data into a script?
> If so, how?
>
> Ex:  I have var1 = city, var2 = state, var3 = zip.  Can I have a file
> containing just different values for these variables and have the script
> take in these values:
>
> "San Francisco","California","94404"
> "Dallas","Texas","32345"
> "Miami","Florida","22342"
>
> So I will have my script run 3 times and each run will grab 1 line.
>
> Thanks in advance,
> Ben
>
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general 


_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to