Grammar / Spell Checking from PB source code example

Developed or developing a new product in PureBasic? Tell the world about it.
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Grammar / Spell Checking from PB source code example

Post 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.
ARGENTINA WORLD CHAMPION
TronDoc
Enthusiast
Enthusiast
Posts: 310
Joined: Wed Apr 30, 2003 3:50 am
Location: 3DoorsDown

Post 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
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post 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.
ARGENTINA WORLD CHAMPION
Cor
Enthusiast
Enthusiast
Posts: 124
Joined: Fri Apr 25, 2003 7:52 pm
Location: Netherlands
Contact:

Post 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?
Cor de Visser

Registered PureBasic user

Author of ChordPlanet
Made with PureBasic
http://www.chordplanet.com
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post 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
ARGENTINA WORLD CHAMPION
Cor
Enthusiast
Enthusiast
Posts: 124
Joined: Fri Apr 25, 2003 7:52 pm
Location: Netherlands
Contact:

Post 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 


Cor de Visser

Registered PureBasic user

Author of ChordPlanet
Made with PureBasic
http://www.chordplanet.com
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post 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.
ARGENTINA WORLD CHAMPION
Cor
Enthusiast
Enthusiast
Posts: 124
Joined: Fri Apr 25, 2003 7:52 pm
Location: Netherlands
Contact:

Post by Cor »

I'am also very interested in this stuff :D
Cor de Visser

Registered PureBasic user

Author of ChordPlanet
Made with PureBasic
http://www.chordplanet.com
Cor
Enthusiast
Enthusiast
Posts: 124
Joined: Fri Apr 25, 2003 7:52 pm
Location: Netherlands
Contact:

Post by Cor »

@Ricardo

Just ordered your dll :D
Cor de Visser

Registered PureBasic user

Author of ChordPlanet
Made with PureBasic
http://www.chordplanet.com
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

@Cor

Did you receive my emails????
ARGENTINA WORLD CHAMPION
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Post by nessie »

@Ricardo,

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