I am writing a script for an IRC channel for a radio station which will basically look at a php file once an hour which will contain which show is on air.
Thing is... I am new to TCL and not sure how to a) get it to perform this action once an hour or b) actually get it to read a php file from a website.
bind time - "00 * * * *" autoupdate
proc autoupdate {set while get putserv} {
set file [open "|lynx -source http://website.com/file.txt" r]
while {![eof $file]} {
gets $file html
if {$html == {}} {continue}
set html [string trimleft $html "<h1>"]
set html [string trimright $html "</h1>"]
putserv "TOPIC $chan :Welcome To The #channel - 4Currently on air:7 $html"
#putserv "NOTICE $chan :$html is now on air.
}
}
I can get it to read from the file fine - but tell me someone, why doesnt run the proc on the hour properly?
to be truthfull I've never done tcl before - and I don't really need to learn it other than to do this one thing. I dont understand all these arguments, so please could someone tell me what arguments to put?
bind time - "00 * * * *" autoupdate
proc autoupdate {00 * * * *} {
set file [open "|lynx -source http://website.com/file.txt" r]
while {![eof $file]} {
gets $file html
if {$html == {}} {continue}
set html [string trimleft $html "<h1>"]
set html [string trimright $html "</h1>"]
putserv "TOPIC $chan :Welcome To The #channel - 4Currently on air:7 $html"
#putserv "NOTICE $chan :$html is now on air.
}
}
I do apologise for my stupidity but this is my first ever use of tcl.