This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
FcLan
Halfop
Posts: 64 Joined: Fri Sep 30, 2005 10:46 am
Location: Poland
Post
by FcLan » Sat Jan 07, 2006 7:39 am
If i use one regexp with "set all" it works, but if I try to use more than 1 it doesn`t work, why?
Code: Select all
package require http
bind pub - !news www:news
proc www:news {nick host handle chan text} {
set token [::http::geturl http://www.sensiblesoccer.de/index.php?lng=en -timeout 10000]
set status [::http::status $token]
if {$status!="ok"} {
switch -exact -- [string tolower $status] {
reset { puthelp "PRIVMSG $chan :error: server connection was reset." }
timeout { puthelp "PRIVMSG $chan :error: server timeout (10 seconds)" }
default { puthelp "PRIVMSG $chan :unknown server error occured" }
}
::http::cleanup $token; return
}
if {[::http::ncode $token]=="404"} {
::http::cleanup $token
puthelp "PRIVMSG $chan :Sorry, error 404"; return
}
set data [::http::data $token]; ::http::cleanup $token
set all [regexp -all -inline -nocase -- {<td class="medium"><b class="marker">(.*?)</font></td>} $data]
set count 1
foreach {tmp t} $all {
if {$count=="4"} {return}
incr count
}
set all2 [regexp -all -inline -nocase -- {<td class="medium"><b class="marker">(.*?)</} $data]
set count 1
foreach {tmp t2} $all {
if {$count=="4"} {return}
puthelp "PRIVMSG $chan :($count) $t $t2"
}
}
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Sun Jan 08, 2006 8:51 am
what does not work there? All is all, there is no more. If you make another regexp on the same string it will beginng from start again and they might even return the same depending on the source.
Maybe you should write more about what you expect of the 1st and 2nd regexp.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
FcLan
Halfop
Posts: 64 Joined: Fri Sep 30, 2005 10:46 am
Location: Poland
Post
by FcLan » Sun Jan 08, 2006 9:54 am
There are html codes for examples, but If I use it doesnt work, only works with 1 regexp.
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Sun Jan 08, 2006 10:07 am
I suppressed the comment last time, but "Doesn't work " is no error description and therefore it won't help us to help you.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
FcLan
Halfop
Posts: 64 Joined: Fri Sep 30, 2005 10:46 am
Location: Poland
Post
by FcLan » Sun Jan 08, 2006 2:02 pm
Doesn`t work = Bot do not sends any msg to channel.
Alchera
Revered One
Posts: 3344 Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:
Post
by Alchera » Sun Jan 08, 2006 9:20 pm
Add [SOLVED] to the thread title if your issue has been.
Search |
FAQ |
RTM