mIRC Home    About    Download    Register    News    Help

Print Thread
New lines on /aline #244395 23/02/14 06:36 PM
Joined: Dec 2010
Posts: 89
D
dominic_eddy Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
I have a socket, getting information from a web page, and it's listing some information I want with <b> tags by the looks of things
Quote:
<center>Statistics for Account Test</center><br> <b><font color='orange'>Admin</font><img src='/img/1.gif'><font color='orange'> - Admin Level 5</font></b><br><b>

In aline, it's displaying it all in one line, and there is no spaces between the information.
Quote:
Statistics for Account Test Admin - Admin Level 5Banned- no

(Im using a script which automatically removes HTML, i found from the internet).
How can I make the stuff display properly, so for example, it should display like this in the aline box
Quote:
Statistics for Account Test
Admin - Admin level 5
Banned- no



current code:
Quote:
aline 5 @AccountCheck - $noHTML(%read)

Quote:
alias noHTML return $regsubex($1, /<[^>]+(?:>|$)|^[^<>]+>/g, $null)

Last edited by dominic_eddy; 23/02/14 06:38 PM.
Re: New lines on /aline [Re: dominic_eddy] #244396 23/02/14 07:04 PM
Joined: Jan 2004
Posts: 1,273
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,273
Code:
alias innertext {
  return $regex($2,$$1-,/>([^>]+?)<\//g)
}

alias test {
  var %text = <center>Statistics for Account Test</center><br>	 <b><font color='orange'>Admin</font><img src='/img/1.gif'><font color='orange'> - Admin Level 5</font></b><br><b>
  var %i = 1, %matches = $innertext(%text)
  while (%i <= %matches) {
    echo -ag $regml(%i)
    inc %i
  }
}

Re: New lines on /aline [Re: Loki12583] #244397 23/02/14 07:41 PM
Joined: Dec 2010
Posts: 89
D
dominic_eddy Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
Thanks loki! this works great laugh although one problem. I put it into my script and each time i run it, it displays this error message once.
/echo: insufficient parameters (line 1154, GXAC2.txt)

Dunno who shocked It still displays everything perfectly. Anyway i can hide this error?

Re: New lines on /aline [Re: dominic_eddy] #244398 23/02/14 08:24 PM
Joined: Jan 2004
Posts: 1,273
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,273
It's probably trying to print whitespace, I've altered the regex such that at least one non-whitespace character must be present to match.

Code:
alias innertext {
  return $regex($2,$$1-,/>(\s*(?:[^>\s]+?\s*)+)<\//g)
}

Re: New lines on /aline [Re: Loki12583] #244399 23/02/14 08:51 PM
Joined: Dec 2010
Posts: 89
D
dominic_eddy Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
Thanks again! =] works great