Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement