mIRC Home    About    Download    Register    News    Help

Print Thread
#47827 07/09/03 02:35 PM
Joined: Sep 2003
Posts: 29
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Sep 2003
Posts: 29
Okay, I want to be able to print out the correct definition of a word from time to time.
Here is my script:

In the alias section:

d {
sockopen dictionary m-w.com 80
%temptext = $$1
set %number 0
}

striphtml {
if ($1) {
var %strip,%parm = <> $remove($1-,> <,><,$chr(9)) <>,%n = 2
while ($gettok($gettok(%parm,%n,62),1,60)) {
%strip = %strip $ifmatch
inc %n
}
return %strip
}
}


And in the remote:

on *:sockopen:dictionary:{
sockwrite -n $sockname GET /cgi-bin/dictionary?book=Dictionary&va=%20 $+ %temptext HTTP/1.1
sockwrite -n $sockname Host: m-w.com $+ $crlf $+ $crlf
}

on *:sockread:dictionary:{
if ($sockerr) {
echo Error.
halt
}
else {
sockread %temptext
if (Main* iswm $striphtml(%temptext)){ echo $striphtml(%temptext) | set %number 1 }
if (%number == 1 ) { echo $striphtml(%temptext)}
if (%number == 1){ if (Get* iswm $striphtml(%temptext)) { set %number 0 } }

}
}

Please you have to help me even if you have to go to the site. I don't know what's wrong. That should from what I can see give me everything between 'main' and 'get' right?
It would be pretty darn cool as well to give them a link to the playing of the sound if that were possible.


#47828 07/09/03 07:58 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
First off, I'd replace your $striphtml with the $removehtml I posted earlier in this thread .

The same thread also has the proper way to request information from a website via sockets. I'd suggest starting with that code, and then changing it to fit your needs.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#47829 07/09/03 11:52 PM
Joined: Sep 2003
Posts: 29
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Sep 2003
Posts: 29
Okay thanks a bunch!
Could someone please tell me as well how to post to a forum by sending information like this? There's a good reason for this.



Link Copied to Clipboard