mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
Code:
on *:SOCKREAD:TICKET*: {
  sockread &data

  if (*BinarySecurityToken Id="PPToken1">t=* iswm $bvar(&data,1-).text) {
    var %start = $calc($bfind(&data,1,BinarySecurityToken Id="PPToken1">t=) + 34), %end = $bvar(&data,1,</wsse:BinarySecurityToken>)

    var %str = $remove($left($bvar(&data,$+(%start,-,%end)).text,401),amp;)
    echo -a %str
  }
}


Problem I'm getting is * Line too long: $bvar (on the IF statement)

The server actually replies back with a massive xml document which can't be read in 1 sockread line as its too long for mirc. how can i do this then?

the string i'm trying to parse out the whole sockread chunk is
Quote:

<wsse:BinarySecurityToken Id="PPToken1">somelongtokenstringhere123456789</wsse:BinarySecurityToken>

Last edited by pouncer; 25/12/09 01:19 AM.
Joined: Jul 2006
Posts: 4,146
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,146
This is because you can't do such a statement, 1- here means more than what mirc can handle, and you don't have to use isin like that, use $bfind, /help $bfind


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
Would I use something like

while ($bfind(...))

straight within the sockread?

Last edited by pouncer; 25/12/09 11:59 AM.
Joined: Jul 2006
Posts: 4,146
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,146
It depend if the string you want can appear more than one time and if you want to catch each string or to count how many there are etc.If you just want to know if the string is inside the bvar, use an if, like you were doing with isin


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
Hm i got a problem with this now.
Code:
on *:SOCKREAD:TICKET*: {
  sockread &data

  if ($bfind(&data, 1, BinarySecurityToken Id="PPToken1">t=)) {

    echo -a $bvar(&data, $ifmatch $+ -).text
  }
}




Problem is that sometimes the server is sending the responses in seperate chunks, so the xml document sent back to me is in multiple responses not 1 chunk. how do i deal with that? because the long string is now split amongst 2 sockread chunks

Joined: Jul 2006
Posts: 4,146
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,146
Write each binvar to a file, then parse this file with /filter or even $read depending on what you want to do


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard