Page 1 of 1

Grammar / Spell Checking from PB source code example

Posted: Wed Jun 04, 2003 8:54 pm
by ricardo
Running example of Spell Check in PB with source code

http://www.getafile.com/cgi-bin/merlot/ ... lCheck.zip


Its a very small and easy code, bu very usefull since you can check the spell/grammar from PB.
I hope you like it :D

*Uses my dll, its included on the zip.

Posted: Wed Jun 04, 2003 9:43 pm
by TronDoc
Checking Spelling from PB using Word - by Ricardo Arias

Code: Select all

;-Read the code from file
If OpenFile(0,"wordspellchecker.vbs"); Read the file to display it on the StringGadget
I don't have MS Word nor do I allow .vbs so I can't try your program :(
Joe

Posted: Wed Jun 04, 2003 10:51 pm
by ricardo
TronDoc wrote:I don't have MS Word nor do I allow .vbs so I can't try your program :(
Joe
Its not important if you don't allow vbs because from my dll its not like doubleclicking a.vbs
I have Norton Antivirus running here and if i try to run a .vbs file directly i get a prompt from the antivirus, but from my dll don't.

But if you don't have Word... thats a problem!!

I don't have it too, so i use my wife PC to test it.

Posted: Wed Jun 04, 2003 11:40 pm
by Cor
@Ricardo,

Nice job, works great here with Dutch spell check

Win98 SE
500 MHZ PIII

Is there a site where I can get this info about COM programming?

Posted: Thu Jun 05, 2003 12:07 am
by ricardo
Cor wrote:Is there a site where I can get this info about COM programming?
I don't know any one.

In my dll m using vbs (very similar to vb) to do call COM using vbs codes, like this one:

Code: Select all

Function CheckSpell(Text)
 Set Word = CreateObject("Word.Application")        'Open Word 
 Word.Visible = False                               'Not visible
 Word.WindowState = 2
 'Create a new instance of Document
 Set Document = Word.Documents.Add( , , 1, True)    'Create a document
 Document.Content=Text                              'Put the text in Doc
 Document.CheckSpelling                             'Checking...
 Document.CheckGrammar
 MyText = Document.Content                          'Get conten once its done
 Word.quit nosave
 CheckSpell = MyText
End Function
Its just VB.

You need to Create an Object (COM object) and then use the properties, methods and events to manage it.

The important part is:
How to know which properties, methods and events has each COM?

Use Ole Viewer (freeware) to see it, many times the names of the properties, methods events are self explicative.
Per example, in the code that we use to check the spell, see this lines:

Code: Select all

 Document.Content=Text '<< we tell Word the content

 Document.CheckSpelling '<< we call CheckSpelling function

 Document.CheckGrammar '<< we call CheckGrammar function

 MyText = Document.Content  '<< we get in our variable the content once its checked

 Word.quit nosave '<< we ask Word to close and tell 'nosave' to avoid the promt asking us for save the file.
As you may see its not to hard, the important thing was to have the possibilitie to have a way to control it inside PB, that why i develope this dll that let us run vbs within PureBasic like if it where PB code and even get results or events.

Now im trying to take advantage of this possibilitie finding way to control everything by this way. Thats why im developing examples :D

Posted: Thu Jun 05, 2003 5:29 am
by Cor
Use Ole Viewer (freeware) to see it, many times the names of the properties, methods events are self explicative.

Code: Select all


@Ricardo,

Where can I find an OLE viewer, and which type of file(s) do you view?

btw.

I'am gonna order this weekend  :D 



Posted: Thu Jun 05, 2003 5:53 am
by ricardo
@Cor

You can find OleViewer here and download it for FREE from:

http://www.microsoft.com/com/resources/oleview.asp

This is a screenshot of the main interface of OleViewer, the nodes has info about the different COM object in your PC

Image

Whenyou choose one object, you can see the methods (functions) available, in this case im looking the functions of some text editor

Image

Im not doing this trying to sale nothing, im just very interested on this tuff (since a lot of time ago sometimes i ask this kind of feature) and want to talk about it.

Posted: Thu Jun 05, 2003 10:06 am
by Cor
I'am also very interested in this stuff :D

Posted: Thu Jun 05, 2003 11:56 pm
by Cor
@Ricardo

Just ordered your dll :D

Posted: Sat Jun 07, 2003 5:53 pm
by ricardo
@Cor

Did you receive my emails????

Posted: Tue Mar 15, 2005 7:47 am
by nessie
@Ricardo,

do you still have this example, or does anyone?. I need to be able to use the spell checker.