mIRC Homepage
Posted By: pouncer sockread parse information - 13/09/06 02:46 AM
Code:
<td colspan="2" class="StyleTahoma" id="MenuTablesLast"><strong>Name:</strong><br>
ICE
</td>
</tr>


how an earth can i capture the name 'ICE' from there? its all seperate lines

if (*Name* iswm Read) .. ?
Posted By: RusselB Re: sockread parse information - 13/09/06 03:36 AM
While it looks like it's on separate lines, as far as the variable that you're reading into is concerned, it's probably all one line.

So to get the ICE from that line, you could use something like
Code:
 if (*name:* iswm %read) {
var %name = $gettok(%read,2,58)
%name = $gettok(%name,2,32)
%name = $gettok(%name,-1,32)
}
 


If this doesn't work, then please provide the website information so that I can look at the actual page source.
Posted By: Riamus2 Re: sockread parse information - 13/09/06 04:40 AM
I'm pretty sure it's on multiple lines in the webpage. They often do that.

This is how I handle those:

Code:
if (*Name:* iswm %your_variable) {
  sockread %your_variable
  var %name = %your_variable
}


This does a second sockread that will read the next line after Name: and then it will store that line as your variable. It's how I do it, but there may be a better way to do that. I've done it where I have put 3-4 sockreads in a row before getting the data.
Posted By: pouncer Re: sockread parse information - 13/09/06 10:42 AM
Quote:
I'm pretty sure it's on multiple lines in the webpage. They often do that.

This is how I handle those:

Code:
if (*Name:* iswm %your_variable) {
  sockread %your_variable
  var %name = %your_variable
}


This does a second sockread that will read the next line after Name: and then it will store that line as your variable. It's how I do it, but there may be a better way to do that. I've done it where I have put 3-4 sockreads in a row before getting the data.


ok mate i will try that. and what if the data i need is on the 3rd or 4th line
Posted By: pouncer Re: sockread parse information - 13/09/06 10:57 AM
ok ive got something like this

Code:
  var %read, %Name, %Age
  sockread %read 

  if (*<strong>Name* iswm %Read) {
    sockread %Read
    %Name = %Read
  }

  if (*<strong>Age* iswm %Read) {
    sockread %Read
    sockread %Read
    %Age = %Read
    info %Name %Age
  }


alias info echo -a $1-

but i cant seem to send %Age and %Name to an alias proeprly, how do i do it?
Posted By: Riamus2 Re: sockread parse information - 13/09/06 12:39 PM
You info %name %age line should not be inside the IF statement.
Posted By: pouncer Re: sockread parse information - 13/09/06 07:54 PM
it is inside the IF mate :s

and i have about 7 if statements like within the sockread, is there any way i can cut it down maybe using regex or something like that
© mIRC Discussion Forums