mIRC Home    About    Download    Register    News    Help

Print Thread
sockread parse information #159060 13/09/06 02:46 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
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) .. ?

Last edited by pouncer; 13/09/06 02:46 AM.
Re: sockread parse information #159061 13/09/06 03:36 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.

Re: sockread parse information #159062 13/09/06 04:40 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: sockread parse information #159063 13/09/06 10:42 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
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

Re: sockread parse information #159064 13/09/06 10:57 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
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?

Last edited by pouncer; 13/09/06 11:17 AM.
Re: sockread parse information #159065 13/09/06 12:39 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You info %name %age line should not be inside the IF statement.


Invision Support
#Invision on irc.irchighway.net
Re: sockread parse information #159066 13/09/06 07:54 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
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

Last edited by pouncer; 13/09/06 07:54 PM.