mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2006
Posts: 1
D
drdevil Offline OP
Mostly harmless
OP Offline
Mostly harmless
D
Joined: Jan 2006
Posts: 1
is it possible to read in a txt file a with a comma (,) seperated text like :

Our members have made a total of <b>22,708</b> posts<br

i want to read the 22,708 by using this code:

on *:TEXT:!forumstats*:*:{ if ($1) { getpdm $iif(#,#,$nick) $2 } }
alias getpdm { .remove p.txt | sockopen pdm dc-styles.com 80 | sockmark pdm $1- }
on *:sockopen:pdm:{ sockwrite -n pdm GET http://www.dc-styles.com/forums/index.php | sockwrite -n pdm Accept: */* | sockwrite -n pdm Host: dc-styles.com:80 | sockwrite -n pdm Proxy-Connection: Keep-Alive | sockwrite -n pdm $crlf }
on *:sockread:pdm:{ if ($sockerr) { return }
:read
sockread &pvar | bwrite p.txt -1 -1 &pvar | if ($sockbr) { goto read }
}
on *:sockclose:pdm:{
tokenize 32 $sock($sockname).mark
if ($regex(xx,$read(p.txt, w,$+(*,Our members have made a,*)),total of <b>([[:digit:]]+))) { msg $1 Total Posts: $regml(xx,1) }
else { msg $1 No matched found }
}

but the result is: Total Posts: 22 instead of 22,708

someone plz help me out! how do i make it it shows the full number or convert the , to a .

DrDevil

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
1) Get $download()

2)
Code:
alias dcstyles {
  if ($download(dcstyles.txt,GET,http://www.dc-styles.com/forums/index.php,3,text)) {
    if ($read(dcstyles.txt,nr,/made a total of &lt;b&gt;(.*?)&lt;\/b&gt; posts/)) return $regml(1)
  }
  else return Error retrieving source.
}


To use you call it like: $dcstyles

Example: //echo -a Total: $dcstyles

Since this result isn't going to change every minute, you should store result in a global var, and retrieve the value of the variable, and only update every 15 minutes or so.

Note the alias dcstyles will pause the script until the result is retrieved, without freezing mIRC. If you want this to be triggered on a channel do it like this:

on *:text:!total:#channel: .timer 1 0 msg # Total: $!dcstyles

The timer is essential, so that $dcstyles doesn't pause your on text event.


Gone.

Link Copied to Clipboard