I am trying to get a random line from a txt file to play every hour, but am stumped on what to change in the following code to make that happen. Any help would be appreciated.
# randline.tcl - read a random line to an IRC dest. every minute
for {set i 0} {$i < 60} {incr i} {bind time - "$i * * * *" readline}
proc readline {minutes hour day month year} {
set fp [open "c:/Inetpub/wwwroot/botads.txt" r]
for {set i 0} {![eof $fp]} {incr i} {set data($i) "[gets $fp]"}
close $fp
For a start, there is no need to loop through a for loop, just to setup a time bind. The time bind matches by a mask, so as long as a * is there, it will run once a min.
Again, there is no need fore the for loop inside the proc, this will only confuse you.