Greetings, brothers and sisters.
I have been trying for a couple days to get an old script working. It's a Google translate script. I haven't used it for ages, and obviously Google has changed a little since then.
alias _trans {
set %gt.lang $gettok($readini(languages\settings.ini,selected, [ $+ [ $ini(languages\settings.ini,selected,1) ] ] ),1,44)
set %gt.phrase $1-
if ($sock(trans)) {
sockclose trans
}
sockopen trans translate.google.ca 80
}
on *:sockopen:trans: {
if ($sockerr) {
echo -s 4Sockopen Error
echo -s $chr(1) $+ 7Socket Name: $sockname
echo -a $chr(1) $+ 7Error Code: $sockerr
halt
}
else {
echo -s 11on Sockopen
sockwrite -n $sockname GET /?hl=en&tab=wT#en| [ $+ [ %gt.lang ] $+ ] | [ $+ [ %gt.phrase ] ]
; HTTP/1.1 <-I don't know if I need this on the end of the above line for it to work or not. With it on, it says " [color:#CC0000] /HTTP/1.1: Not connected to server [/color] "
sockwrite -n $sockname Host: translate.google.ca
sockwrite -n $sockname User-Agent: Opera 9.6
}
}
I'm using Firefox with the Firebug plugin to find the exact location of the translated text:
<span class="hps">(translated text appears here)</span>
I have looked at examples galore, and still can not figure out how to make the socket point at the correct piece of code.
Can someone please nudge me in the right direction...