mIRC Homepage
Posted By: realillusion DDE and iexplore. - 01/09/03 10:14 PM
Would it be possible to read the contents of an iexplore web page using DDE? Like, suppose I wanted to make a script to pull a definition off of www.dictionary.com... something like:

alias /def {
/dde iexplore WWW_OpenURL http://dictionary.reference.com/search?q= $+ $replace($1-,$chr(32),% $+ 20)
}

That would OPEN the page, right? How could I read its contents, though?
Posted By: MTec89 Re: DDE and iexplore. - 01/09/03 10:46 PM
dde? no..i think u want sockets... /help sockets smirk
Posted By: realillusion Re: DDE and iexplore. - 01/09/03 11:14 PM
Yeah, well, I don't know much of anything about sockets.

I read the help section (not the first time I've read it, either) but I don't really know how to use this to do what I want. I would guess the first step is to use /sockopen to connect to... my own computer, on any port. Then what? I guess I use /sockwrite to send info to that connection, but what info do I send? Should I be sending something like /sockwrite (name) run iexplore...?

I think it's pretty clear I don't know what I'm doing, especially when it comes to sockets. :-D
Posted By: theRat Re: DDE and iexplore. - 02/09/03 04:48 AM
No no no....
You connect to the server where you want the info to be retrieved...

try using the search function of these boards, and you'll find many examples how to do that...
Posted By: demitrix Re: DDE and iexplore. - 02/09/03 05:47 AM
Code:
 
alias dict {
  %string = $replace($1-,$chr(32),+)
  sockopen DICT dictionary.com 80
}
on *:SOCKOPEN:DICT:{
  sockwrite -n $sockname GET /search?q= $+ %string
  sockwrite -n $sockname Host: dictionary.com.org $+ $crlf $+ $crlf
}
on *:SOCKREAD:DICT:{
  if ($sockerr) {
    echo -a Error!
  }
  else {
    var %socktext
    sockread %socktext
    if (<TABLE>* $+ $replace(%string,+,$chr(32)) $+ * iswm %socktext) {
      echo -a $left($htmlfree(%socktext),$len(%string))
    }
    if (<OL><LI> isin %socktext) {
      commands to get definition out of HTML
    }
  }
}
alias htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
  return %x
}
 

something along thoes lines
im my AIM... demitrixrd
and ill help you out if u dont get it
© mIRC Discussion Forums