Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. menu channel,query {
  2. Spelling and Grammar Check
  3. .$submenu($SGC:Menu($1-))
  4. }
  5. alias -l SGC:Safe bset -ct &a 1 $1 | return $!regsubex(safe, $bvar(&a,1-) ,/(\d+)(?: |$)/g,$chr(\1))
  6. alias -l SGC:Conf if ($isid) return $isbit(%SGC:Conf,$1) | set %SGC:Conf $xor($iif(%SGC:Conf,$v1,0),$calc(2^($1 -1)))
  7. alias -l SGC:Menu {
  8. if ($SGC:Conf(1) && $1 == 1) return Disable: SGC:Cleanup $(|) SGC:Conf 1
  9. elseif ($1 == 1) return Enable:SGC:Conf 1
  10. elseif ($1 == 2) return $iif($calc($iif(!$SGC:Conf(1),2) + $iif($SGC:Conf(2),1)),$style($v1)) CheckGrammar: SGC:Conf 2
  11. }
  12. alias SGC:Cleanup {
  13. if ($com(SGC:Con)) .comclose $v1
  14. if ($com(SGC:Doc)) .comclose $v1 $com($v1,Close,1,bool,false)
  15. if ($com(SGC:Docs)) .comclose $v1
  16. if ($com(SGC:Word)) .comclose $v1 $com($v1,Quit,1)
  17. }
  18.  
  19. on *:LOAD:{
  20. SGC:Cleanup
  21. if ($os isin 95 98) %r = You need atleast Windows 2000 or later for this script to function
  22. elseif ($version < 6.2) %r = You need to be using mIRC 6.2 or later for this script to function
  23. else {
  24. .comopen SGC:Word word.Application
  25. if ($comerr) %r = You need Microsoft Word 2003 or later installed for this script to function
  26. }
  27. if (%r) {
  28. echo -ag * $+($chr(2),$chr(3),04Spelling and Grammar Check,$chr(15),:) %r
  29. .timer -m 1 1 .unload -rs $qt($script)
  30. }
  31. else {
  32. set %SGC:Conf 3
  33. echo -ag * $+($chr(2),$chr(3),03Spelling and Grammar Check,$chr(15)) is now loaded and functional
  34. }
  35. }
  36. on *:INPUT:*:{
  37. if ($window($active).type isin channel query) && (!$inpaste && !$ctrlenter && $isbit($mouse.key,3)) {
  38. if (!$SGC:Conf(1)) {
  39. .timer -m 1 1 editbox -n $SGC:Safe($active $1-)
  40. halt
  41. }
  42. var %r
  43. if (!$com(SGC:Word) || !$com(SGC:Docs) || !$com(SGC:Doc)) {
  44. SGC:Cleanup
  45. .comopen SGC:Word word.Application
  46. if ($comerr) %r = You must have Microsoft Word 2003 or later installed for this script to work
  47. elseif (!$com(SGC:Word,Visible,5,bool,false)) %r = Unable to hide MS Word COM window
  48. elseif (!$com(SGC:Word,Documents,2,dispatch* SGC:Docs)) %r = Unable to get get list of open MS Word COM documents.
  49. elseif (!$com(SGC:Docs,Add, 1,error,,error,,error,, bool,false,dispatch* SGC:Doc)) %r = Unable to create a new MS Word COM document.
  50. }
  51. if (!%r) {
  52. 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.
  53. elseif (!$com(SGC:Doc,$iif($SGC:Conf(2),CheckGrammar,CheckSpelling),1)) %r = Unable to check Spelling and/or Grammar of specified text.
  54. elseif (!$com(SGC:Doc,Content,2,dispatch* SGC:Con)) %r = Unable to request corrected text from the MS Word COM document.
  55. elseif (!$com(SGC:Con,Text,2)) %r = Unable to retrieve corrected text from the MS Word COM document.
  56. else {
  57. .timer -m 1 1 editbox -n $SGC:Safe($active $regsubex($com(SGC:Con).result,[\r\n]+$,))
  58. .comclose SGC:Con
  59. halt
  60. }
  61. }
  62. :error
  63. %r = $iif(%r,$v1,$error)
  64. reseterror
  65. SGC:Cleanup
  66. echo -ag * $+($chr(2),$chr(3),04Spelling and Grammar Check,$chr(15),:) %r
  67. }
  68. }
  69. on *:EXIT:SGC:Cleanup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement