Dang

Sure thing

k,

Code:

break on

srnd(@ticks)

$file = @scriptdir + '\test.txt'
$_ = open(1,$file)

;read contents of file to a delimited string value
$txt = readline(1)
while not @error
$txt = $txt + "~" + readline(1)
loop
$_ = close(1)

$txt = left($txt,-1) ;remove last delimiter
$txt = split($txt,'~') ;split that string to an array

$rand = rnd(ubound($txt))
if $rand = ubound($txt) $rand = $rand - 1 endif
"Random line #" + $rand+1 + ": " + $txt[$rand] ?
"Random line #" + $rand+2 + ": " + $txt[$rand+1] ?

get $
exit 0



Well, make sure that there always at least 2 lines of text in your file


Edited by Jochen (2005-06-16 02:15 PM)
_________________________