[EMAIL PROTECTED] wrote:
>
> I'm trying to make a rebol script which reads a text file which
> contains a list of urls, parses the result into a series and store
> them as a block of urls.
>
One other variation on this theme... If the file contains only URLs
(as text), one per line, as in:
>> print read %fileofurls.text
http://www.fedex.com/
http://www.yahoo.com/
http://www.netscape.com/
http://www.dogpile.com/
http://www.rebol.com/
you can process the URLs, each in turn, with:
>> foreach line read/lines %fileofurls.text [
print [length? read to-url line "^-" line]
]
10306 http://www.fedex.com/
12052 http://www.yahoo.com/
46627 http://www.netscape.com/
19140 http://www.dogpile.com/
10952 http://www.rebol.com/
where the body of the loop contains your code, of course. If you
really want a collection of URL objects as a result, e.g. for later
reuse, you can modify the above to:
>> geturls: func [f [file!] /local b] [
b: copy []
foreach line read/lines f [
append b to-url line
]
b
]
>> geturls %fileofurls.text
== [http://www.fedex.com/ http://www.yahoo.com/
http://www.netscape.com/
http://www.dogpile.com/ http://www.rebol.com/]
-jn-