mIRC Home    About    Download    Register    News    Help

Print Thread
Spell checker #52768 06/10/03 05:41 PM
Joined: Sep 2003
Posts: 20
E
emull Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Sep 2003
Posts: 20
On mircscripts.org, I have been discussing a spell checker which interacts with MS Word. A person nicknamed Online came up with this alias:

> Is it possible to retrieve suggestions to certain words? :-)
> How do you specify dictionary etc?

Hi, this is the best alias i could come up with

alias spell {
window -h @@
var %a = aline @@
%a Set objWord = CreateObject("Word.Application")
%a objWord.Visible = True
%a objWord.Documents.Add
%a objWord.ActiveDocument.Content = $+(",$remove($1-,\,"),")
%a objWord.ActiveDocument.CheckSpelling
%a Set fso = CreateObject("Scripting.FileSystemObject")
%a Set f = fso.OpenTextFile("temp.txt", 2, True)
%a f.Write objWord.ActiveDocument.Content
%a objWord.ActiveDocument.Close False
%a objWord.Application.Quit True
savebuf @@ temp.vbs
close -@ @@
.comopen run WScript.Shell
.comclose run $com(run,Run,3,bstr,wscript temp.vbs,uint,5,bool,true)
var %n = $read(temp.txt,t)
.remove temp.txt
.remove temp.vbs
return %n
}

If i find any other idea i'll inform you.

- Online

Now, I'm wondering if anyone else might have something to contribute regarding this matter. How do you for example retrieve suggestions, synonyms. How do you specify dictionary etc.

Any help is appreciated. laugh

Re: Spell checker #52769 06/10/03 09:15 PM
Joined: Aug 2003
Posts: 19
P
Propogater Offline
Pikka bird
Offline
Pikka bird
P
Joined: Aug 2003
Posts: 19
You need to read up on com objects and the syntax for MS Word in order to retreive synonyms and whatnot. Maybe liner are able to direct you to a place where you can read about COM Objects. If I am not mistaken tho', that spellchecker is a bit slow.

Good job as always online smile

Your'n


Propogater @ DALnet, #HelpDesk and #Help
Re: Spell checker #52770 07/10/03 07:02 AM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
'lo Prop, you always appear when I least expect you laugh

As you can see, the $spell() alias doesn't contain even a single $com call; everything is done through an external VBS file, and that's because mIRC doesn't fully support the methods it uses.

This is the reference where I learnt from: http://www.4guysfromrolla.com/webtech/062402-1.shtml

The ZIP file that is attached to the article contains some useful information as well as a TXT file with a ready code.

You can download a HTML file based on that code, open it with your browser and see how the string 'suugest a corection' is automatically corrected with the first suggestion for every wrong word (tested with Word2000).

It would be a little pain to pass everything to mIRC and let the user select suggestions from a custom dialog, but with some tweaking it might be possible. Just tell me what you're planning...

Re: Spell checker #52771 07/10/03 02:52 PM
Joined: Sep 2003
Posts: 20
E
emull Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Sep 2003
Posts: 20
Amoung other problems, when I have used the alias, and when Windows closes, it asks if I want to save changes of the document opened by the script. How do I make it close the document after usage?

Re: Spell checker #52772 07/10/03 05:24 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
With Word97 and 2000 it doesn't ask if you want to save changes (tested), the lines "objWord.ActiveDocument.Close False" and "objWord.Application.Quit True" should make it automatically exit after you finished selecting the corrections.