proc foo {n u h c t} {
set x [::http::geturl http://www.domain.com/file.txt]
foreach e [split [::http::data $x] \n] {
regsub -all {<([^<])*>} $e {} e
puthelp "privmsg $c :$e"
}
}
And I understand that regsub -all won't read the html tags...
But how can I make the script so it won't read the 2nd line until the end of the file? So it will only output the first line?
you don't need all those args if you're calling the proc in a timer. the reason why the script doesnt work is that you call the proc with no args, while it requires 'n u h c t' as arguments.
you either give all the params when calling the proc, or you use the following code:
bind time - * man ;# runs every minute
proc man {m h d mo y} {
set a [info exists check]
set fs [open file.txt r]
gets $fs line(first)
close $fs
if { $a == 1 } {
if { $check != $line(first) } {
putserv "PRIVMSG #channel1 :$line(first)"
unset check
set check "$line(first)"
}
} elseif { $a == 0 } {
set burpie "a is 0"
putserv "PRIVMSG #channel1 :$burpie"
set check "$line(first)"
} else {
set burp "damnit, a is not 0 or 1"
putserv "PRIVMSG #channel1 :$burp"
}
}
package require http
# set your channel name and url
set channelx "#mychannel"
set fileurl "http://myurl/text.txt"
# don't edit below this line
set ol ""
bind time - * man
proc man {m h d mo y} {
global channelx ol fileurl
set x [::http::geturl $fileurl]
set x2 [split [::http::data $x] \n]
set nl [lindex $x2 0]
if {$nl != $ol} {
set ol [lindex $x2 0]
puthelp "PRIVMSG $channelx :$nl"
}
}