|
Joined: Apr 2003
Posts: 16
Pikka bird
|
OP
Pikka bird
Joined: Apr 2003
Posts: 16 |
this works for getting a specific number at a specific place out of a txt file: alias fstats {
if ($read(fstats.txt,w,*<a href="index.cgi?action=mlall"><B>*</B></a>*)) {
var %tm = $read(fstats.txt,$readn)
/msg #adasda Total Members: $gettok($mid(%tm,$calc($pos(%tm,mlall) + 10)),1,$asc(<))
} so i thought this would work too: alias fstats {
if ($read(fstats.txt,w,*<a href="index.cgi?action=mlall"><B>*</B></a>*)) {
var %tm = $read(fstats.txt,$readn)
elseif ($read(fstats.txt,w,*Newest Member: <A HREF="index.cgi?action=viewprofile&username=*"><B>*</B>*)) {
var %nm = $read(fstats.txt,$readn)
/msg #adasda Total Members: $gettok($mid(%tm,$calc($pos(%tm,mlall) + 10)),1,$asc(<)) Newest Member: $gettok($mid(%nm,$calc($pos(%nm,viewprof) + 25)),1,$asc(<))
} but it doesnt... any suggestions?
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
Maybe take out the 'else' from 'elseif' alias fstats {
if ($read(fstats.txt,w,*<a href="index.cgi?action=mlall"><B>*</B></a>*)) {
var %tm = $ifmatch
}
[color:gray]if[/color] ($read(fstats.txt,w,*Newest Member: <A HREF="index.cgi?action=viewprofile&username=*"><B>*</B>*)) {
var %nm = $ifmatch
}
msg #adasda Total Members: $gettok($mid(%tm,$calc($pos(%tm,mlall) + 10)),1,$asc(<)) Newest Member: $gettok($mid(%nm,$calc($pos(%nm,viewprof) + 25)),1,$asc(<))
}
|
|
|
|
Joined: Apr 2003
Posts: 16
Pikka bird
|
OP
Pikka bird
Joined: Apr 2003
Posts: 16 |
yes! thx, this works; but i came into more trouble: i look for this part of the text: <font size="1">2 Guests, 8 Users<BR> ... and want to output 2 Guests, 8 Users the number of guests and users will change everytime so i use * when i search for it like this: if ($read(fstats.txt,w,*<font size="1">* Guests, * Users<BR>*)) {
var %on = $ifmatch
} and use $gettok like this: $gettok($mid(%on,$calc($pos(%on,size) +9)),1,$asc(<)) ..but it doesnt work it works fine here with: if ($read(fstats.txt,w,*<a href="index.cgi?action=mlall"><B>*</B></a>*)) {
var %tm = $ifmatch
}
and $gettok($mid(%tm,$calc($pos(%tm,mlall) + 10)),1,$asc(<)) to get 689 out of <a href="index.cgi?action=mlall"><B>689</B></a> why does the second example work and first one not?? i already tried to remove the spaces between * and Guests and so on.. and the txt is 100% there in the textfile comments welcome, thx ..
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
If that is all the line contains //var %on = <font size="1">2 Guests, 8 Users<BR> | echo -a $gettok($gettok(%on,2,62),1,60) 2 Guests, 8 Users
If there is more in the line, you would have to consider that as well.
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
alias fstats {
if $sock(fstats) { sockclose fstats }
sockopen fstats hyperboards.hyperboards.com 80
}
on *:SOCKOPEN:fstats:{
if $sockerr { echo $color(info) -s * Error: $sock($sockname).wsmsg | return }
sockwrite -n $sockname GET /index.cgi HTTP/1.0
sockwrite -n $sockname HOST: hyperboards.hyperboards.com
sockwrite -n $sockname $crlf
}
on *:sockread:fstats:{
if $sockerr { echo $color(info) -s * Error: $sock($sockname).wsmsg | return }
var %a
sockread %a
while $sockbr {
var %a = $remhtml(%a)
if Total Members:* iswm %a { set -u900 %fstats.tmembers $gettok(%a,3,32) }
if Newest Member:* iswm %a { set -u900 %fstats.nmember $gettok(%a,3,32) }
if Total Topics:* iswm %a {
set -u900 %fstats.ttopics $gettok(%a,3,32)
set -u900 %fstats.tposts $gettok(%a,7,32)
}
if *Guests*Users* iswm %a {
!.echo -q $regsub(%a,/(.*Users)(.+)/,\1,%a)
set -u900 %fstats.online %a
}
if Last Updated Topic:* iswm %a { set -u900 %fstats.ltopic $gettok($gettok(%a,4-,32),1,41) $+ ) }
sockread %a
}
}
on *:sockclose:fstats:{
linesep -s
echo 9 -s Forum Statistics
echo 14 -s Total Topics:9 %fstats.ttopics
echo 14 -s Total Posts:9 %fstats.tposts
echo 14 -s Total Members:9 %fstats.tmembers
echo 14 -s Newest Member:9 %fstats.nmember
echo 14 -s Last Updated Topic:9 %fstats.ltopic
echo 14 -s Online:9 %fstats.online
linesep -s
}
alias -l remhtml {
var %a | !.echo -q $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,,%a)
return $remove(%a,&nbsp;)
} The %fstats.* variables are set for 15 minutes (900 secs).
|
|
|
|
Joined: Apr 2003
Posts: 16
Pikka bird
|
OP
Pikka bird
Joined: Apr 2003
Posts: 16 |
if ($read(fstats.txt,w,*<td valign="top" align="left"><font size="1">*Users<BR><A HREF*)) {
var %on = $ifmatch
} + $gettok($mid(%on,$calc($pos(%on,size="1">) +9)),1,$asc(<)) works ) nevertheless thx for your help
|
|
|
|
|