mIRC Home    About    Download    Register    News    Help

Print Thread
#52373 03/10/03 09:19 AM
Joined: Jan 2003
Posts: 109
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Jan 2003
Posts: 109
Hi

I have some scripts that pull news headlines from websites to display in my channel - however, sometimes when a character appears in a headline, it displays the value of that character, instead of the character itself - example:

BA's Marshall rules out near-term tie-up with Iberia on regulatory grounds

should read:
BA's Marshall rules out near-term tie-up with Iberia on regulatory grounds

Any easy way around this?
Thanks!


#Newsroom
Where News & Markets Connect
http://www.inewsroom.net
#52374 03/10/03 11:32 AM
Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
I think that this can be achieved pretty easily with regexp & $chr as ' is ' and its ascii is 39...


Code:
//if ( khaled isgod ) echo yes | else echo no
#52375 03/10/03 01:09 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Code:
alias spchrs {
  var %a = $1-
  while $regex(%a,/(&#\d*;)/) { var %a = $replace(%a,$regml(1),$chr($remove($regml(1),&#,;))) }
  return %a
}
Code:
  var %a = BA's Marshall rules out near-term tie-up with Iberia on regulatory grounds
  echo -a $spchrs(%a)
as this is from a sockread it most likely already is a %var. smile

#52376 03/10/03 01:15 PM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Edited - Iori has posted a far better method smile

Last edited by cold; 03/10/03 01:16 PM.

* cold edits his posts 24/7
#52377 04/10/03 02:47 AM
Joined: Jan 2003
Posts: 109
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Jan 2003
Posts: 109
thank you all. Iori - here's my code (minus the socket stuff)
if you could possibly assist me as to where to insert your code, I'd be gratefull...!

on 1:sockread:info:{
if ($sockerr > 0) return
:nextread
sockread %newstemp
if ($sockbr == 0) return
if (%newstemp == $null) %newstemp = -
if (<td nowrap valign=top isin %newstemp) {
set %infotxt $remove($gettok(%newstemp,5,62),</td)
write -l4 scripts/news.txt %infotxt - Infotec
sockclose info
set %info $read(scripts\news.txt,nw,*- Infotec*)
if (%info == $null) return
if (%info.last != %info) {
set %info.last %info {
msg #NewsRoom 0,7»1,15 $asctime($calc( $gmt + 7200 ),HH:nn)) $+ CET > %info 7,7 0,14 url .itec 
}
}
}
}

thank you again.


#Newsroom
Where News & Markets Connect
http://www.inewsroom.net
#52378 06/10/03 07:36 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Code:
on *:sockread:info:{
  if $sockerr { return }
  var %info | sockread %info
  while $sockbr { 
    if (&lt;td nowrap valign=top isin %info) { 
      var %info = [color:green]$spchrs($remove($gettok(%info,5,62),&lt;/td))[/color] - Infotec
      ; Do you need to write the info? (You don't for this code.)
      write -l4 scripts/news.txt %info
      sockclose info
      if (%info.last != %info) {
        set %info.last %info
        msg #NewsRoom 0,7»1,15 $time($calc($gmt +7200),HH:nn)) $+ CET &gt; %info 0,7«0,14 url .itec 
      }
    }
    sockread %info
  }
}
Edit: Of course, you will need the spchrs alias from the earlier post. smile

Last edited by Iori; 06/10/03 07:38 AM.

Link Copied to Clipboard