This snippet Uses MS Word's(2003 or later) API and mIRC's COMs to spell/grammar check your text. If there is an incorrect word a dialog will pop up asking you to replace or ignore it. If everything is spelled correctly, the dialog won't appear.
If for whatever reasons, the spell/grammar check dialog opens behind your mIRC, hold the alt key, and (keep) pressing tab until the MS Word Icon is selected then release both keys. This will bring the dialog to the forground.
The Script will need:
mIRC 6.2x or later
MS Windows 2000 or later
MS Word 2003 or later
To Load:
place in a fresh remotes file
To Use:
Type in the edit box, press shift+enter to spell/grammar check the text before sending
Notes:
Due to WINE's lack of com support, this will not work with mIRC ran under WINE
Having other "on INPUT" events may cause problems with this/that/those script(s) .
To fix this issue add the following line as the first command to be executed from those scripts' on input events:
Screen Shot:
http://i55.tinypic.com/24xevc7.png
Updates:
January 26, 2012
Now using a variable instead of an empty group
Fixed to work with queries now
Bug with the dialog opening behind mIRC still eludes me :<
December 27, 2011
Added Grammar Checking.
Added Menu to channel and query windows to toggle Checks
Can now toggle Spelling and/or Grammar checks on or off
Fixed cleanup not happening on disabling
July 03, 2011
Added a 'windowstate set' to hopefully fix the spellcheck dialog opening behind mIRC
June 20, 2011
Added Check to make sure mIRC is not set as ontop
Did some reorganizing of the code[removed all those goto's]
On Input now calls the $SpellCheck immediately, and then uses a timer to set the editbox text
Changed timer from -h to -m[-h was causing a recusion bug]
Cleaned up the code.
Comments/Flames/Questions/Suggestions are GREATLY appreciated.... Without user input there can not be developer output
menu channel,query {
Spelling and Grammar Check
.$submenu($SGC:Menu($1-))
}
alias -l SGC:Safe bset -ct &a 1 $1 | return $!regsubex(safe, $bvar(&a,1-) ,/(\d+)(?: |$)/g,$chr(\1))
alias -l SGC:Conf if ($isid) return $isbit(%SGC:Conf,$1) | set %SGC:Conf $xor($iif(%SGC:Conf,$v1,0),$calc(2^($1 -1)))
alias -l SGC:Menu {
if ($SGC:Conf(1) && $1 == 1) return Disable: SGC:Cleanup $(|) SGC:Conf 1
elseif ($1 == 1) return Enable:SGC:Conf 1
elseif ($1 == 2) return $iif($calc($iif(!$SGC:Conf(1),2) + $iif($SGC:Conf(2),1)),$style($v1)) CheckGrammar: SGC:Conf 2
}
alias SGC:Cleanup {
if ($com(SGC:Con)) .comclose $v1
if ($com(SGC:Doc)) .comclose $v1 $com($v1,Close,1,bool,false)
if ($com(SGC:Docs)) .comclose $v1
if ($com(SGC:Word)) .comclose $v1 $com($v1,Quit,1)
}
on *:LOAD:{
SGC:Cleanup
if ($os isin 95 98) %r = You need atleast Windows 2000 or later for this script to function
elseif ($version < 6.2) %r = You need to be using mIRC 6.2 or later for this script to function
else {
.comopen SGC:Word word.Application
if ($comerr) %r = You need Microsoft Word 2003 or later installed for this script to function
}
if (%r) {
echo -ag * $+($chr(2),$chr(3),04Spelling and Grammar Check,$chr(15),:) %r
.timer -m 1 1 .unload -rs $qt($script)
}
else {
set %SGC:Conf 3
echo -ag * $+($chr(2),$chr(3),03Spelling and Grammar Check,$chr(15)) is now loaded and functional
}
}
on *:INPUT:*:{
if ($window($active).type isin channel query) && (!$inpaste && !$ctrlenter && $isbit($mouse.key,3)) {
if (!$SGC:Conf(1)) {
.timer -m 1 1 editbox -n $SGC:Safe($active $1-)
halt
}
var %r
if (!$com(SGC:Word) || !$com(SGC:Docs) || !$com(SGC:Doc)) {
SGC:Cleanup
.comopen SGC:Word word.Application
if ($comerr) %r = You must have Microsoft Word 2003 or later installed for this script to work
elseif (!$com(SGC:Word,Visible,5,bool,false)) %r = Unable to hide MS Word COM window
elseif (!$com(SGC:Word,Documents,2,dispatch* SGC:Docs)) %r = Unable to get get list of open MS Word COM documents.
elseif (!$com(SGC:Docs,Add, 1,error,,error,,error,, bool,false,dispatch* SGC:Doc)) %r = Unable to create a new MS Word COM document.
}
if (!%r) {
if (!$com(SGC:Doc,Content,4,bstr,$1-)) %r = Unable to copy text to be Spell and/or Grammar checked into the MS Word COM document.
elseif (!$com(SGC:Doc,$iif($SGC:Conf(2),CheckGrammar,CheckSpelling),1)) %r = Unable to check Spelling and/or Grammar of specified text.
elseif (!$com(SGC:Doc,Content,2,dispatch* SGC:Con)) %r = Unable to request corrected text from the MS Word COM document.
elseif (!$com(SGC:Con,Text,2)) %r = Unable to retrieve corrected text from the MS Word COM document.
else {
.timer -m 1 1 editbox -n $SGC:Safe($active $regsubex($com(SGC:Con).result,[\r\n]+$,))
.comclose SGC:Con
halt
}
}
:error
%r = $iif(%r,$v1,$error)
reseterror
SGC:Cleanup
echo -ag * $+($chr(2),$chr(3),04Spelling and Grammar Check,$chr(15),:) %r
}
}
on *:EXIT:SGC:Cleanup
on *:UNLOAD:SGC:Cleanup | unset %SGC:Conf