; [- 'Spell Checker v1.0' by *Visualise* -]
;
; Description: Checks words suspected to be incorrectly spelt against google's autosuggest feature.
; Compatibility: mIRC v6.2 and above (due to $editbox identifier).
; Installation: Simply load the script, and edit the %timeout variable on line 11 if needed.
; Usage: Highlight the word suspected to be incorrectly spelt and press F6.
alias f6 {
; Set the connection timeout below [default 10].
var %timeout 10
var %t $strip($editbox($active))
var %s $editbox($active).selstart
var %e $editbox($active).selend
if ((%s) && (%e)) {
var %d $calc(%e - %s)
set %gsug $mid(%t,%s,%d)
if (%d == 0) { echo -a 4Error: You Didn't Select A Word | halt }
if ($numtok(%gsug,32) > 1) { echo -a 4Error: You Selected Multiple Words | halt }
if ($numtok(%gsug,32) == 0) { echo -a 4Error: You Didn't Select A Word | halt }
sockopen gsug www.google.com 80
.timergsug 1 %timeout sockclose gsug
}
}
on *:sockopen:gsug:{
sockwrite -n gsug GET /search?hl=en&q=define%3A+ $+ %gsug $+ &meta= HTTP/1.1
sockwrite -n gsug Host: www.google.com $+ $crlf $+ $crlf
}
on *:sockread:gsug:{
var %t
sockread %t
if (*&spell=1* iswm %t) {
sockclose gsug
var %n $numtok(%t,$asc(&))
var %i 1
while (%i <= %n) {
var %q = $gettok(%t,%i,$asc(&))
if ((q=* iswm %q) && ($numtok(%q,32) == 1)) {
var %x %q
break
}
inc %i
}
if (%x) {
echo -a 4Suggested Word: $gettok(%x,2,$asc(+))
.timergsug off
}
}
elseif (*</html>* iswm %t) {
echo -a 4No Suggestion for: %gsug
sockclose gsug
.timergsug off
}
}