mIRC Home    About    Download    Register    News    Help

Print Thread
#47558 06/09/03 03:49 AM
Joined: Dec 2002
Posts: 204
K
keeker Offline OP
Fjord artisan
OP Offline
Fjord artisan
K
Joined: Dec 2002
Posts: 204
Got slight problem with stripping HTML from an at window for a weather script. the $striphtml identifier is from a post that was on here recently but in that post the data was stripped as its coming off the socket, in mine i created the socket, sent and got data, put all the data in a @window, used $fline and /filter to seperate the parts i need into @window_2, and now i am stuck, because the $striphtml wont work, maybe cause i modified it slightly, but that was just to check for a $null line and replace it with a *** thingy. Can yall puruse my code and tell me where i went wrong? i know once i strip the html from the data, it will be easiy for me to format the results. any help would be appreciated. confused
Code:
alias -l getwet {
  var %fl $fline(@weather,*<b>Conditions</b>*,1)
  echo -s first line %fl
  var %ll $fline(@weather,*<td>Clouds <br>*,1)
  echo -s last line %ll
  window @weather_2
  echo -s opening window @weather_2
  echo -s Attempting to copy lines %fl to %ll
  filter -wwcr %f1 $+ - $+ %ll @weather @weather_2
  echo -s Lines %fl to %ll copied to @weather_2
  window -c @weather
  echo -s Window @weather closed ... Attempting to strip HTML
  var %cl $line(@weather_2,0)
  var %tl 
  echo -s opening @weather_3 for stripped data
  window @weather_3
  echo -s opened, beginning strip
  while %cl < %tl {
    aline @weather_3 $striphtml($line(@weather,%cl))
    dec %cl
  }
  echo -s Finished Stripping
}

alias striphtml {
  var %return, %regex = $regsub($1-,/(^[^>]*>|<[^>]*>|<[^<]*$)/g,$null,%return)
  return $iif($remove(%return,$chr(9), ) != $null,$remove(%return,$chr(9), ),$chr(42) $+ $chr(42) $+ $chr(42))
}



edit: changed post title

Last edited by keeker; 06/09/03 03:51 AM.

keek: Scots - intr.v. keeked, keekĀ·ing, keeks
To peek; peep.
#47559 06/09/03 08:33 PM
Joined: Jun 2003
Posts: 67
D
Babel fish
Offline
Babel fish
D
Joined: Jun 2003
Posts: 67
Code:
alias htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
  return %x
}


Last edited by demitrix; 06/09/03 08:34 PM.

while (demi == nub) {
inc %skill
}

Link Copied to Clipboard