| View previous topic :: View next topic |
| Author |
Message |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Mon Sep 01, 2003 11:06 am Post subject: Spell Check Idea ! |
|
|
How could you create a DSU using the following and DDE to make a Spellcheck DSU using Word ?
I do not know what lanuage these are in but maybe someone here can figure it out !
| Code: | The following example demonstrates how to integrate the Word spell checker with ArcView. You may find this has practical application in a variety of instances.
Five files are in this file:
README.TXT
GETSPELL.TXT
MINAPP.TXT
SPELL1.AVE
SPELL2.AVE
README.TXT
==========
ArcView Spell Checker
Here are the instructions for making use of the spell checking capabilities of Word and integrating them with ArcView.
Step 1: Create a global macro in Word named GetSpellings using the text in GETSPELL.TXT.
Step 2: Create a global macro in Word named MinApp using the text in MINAPP.TXT.
To create a global macro in Word
1. Choose the Macro option from the Tools menu.
2. Enter the name GetSpellings. If you want add a description of the macro in the appropriate location at the bottom of the dialog box.
3. Click Edit. Add the text from the appropriate text file.
Step 3: Create a Word document named spell.doc that has a single bookmark in it located at the beginning of the document. Name the bookmark "Spelling".
To create a bookmark and save the file in Word 6.0
1. Select Bookmark from the Insert menu.
2. Enter the name Spelling in the text entry field.
3. Click OK.
4. Click Close, and save the current version of the document with its new bookmark.
To create a bookmark and save the file in Word 7.0
1. Select Bookmark from the Edit menu.
2. Enter the name Spelling in the text entry field.
3. Click Add.
Step 4: Create a script in ArcView named Spell1 using the text in SPELL1.AVE.
Step 5: Create a script in ArcView named Spell2 using the text in SPELL2.AVE.
Step 6: Run Spell1.
GETSPELL.TXT
============
Sub MAIN
Dim Word$(30) 'Declare array for suggested spellings
Result = StartOfDocument(1) 'Goto beginning of document
N = ToolsGetSpelling(Word$())'Get suggested spellings of selected word
'To add a custom dictionary use this syntax in the line above:
'N = ToolsGetSpelling(Word$(),,,< path and filename for a custom dictionary>)
'for example: "C:\WINWORD\USER1.DIC"
If N >= 0 Then'If Result is greater than or equal to zero->process
Select Case N
Case 0 'Result=0 because correctly spelled
W$ = "|Word spelled correctly" 'replace word with this msg
Case Else 'For any other positive number
For I = 1 To N 'Create a string delimited by |
W$ = W$ + "|" + Word$(I)
Next I
End Select
End If
'If the result is -1 or a single | symbol, no words found to suggest
If (N = - 1) Or (W$ = "|") Then W$ = "|<No words found>"
'Select the word in the document and replace it with the msg string
'If using Word 6.0 use:
'EditReplace .Find = Selection$(), .Replace = W$, .ReplaceAll
'If using Word 7.0 use:
insert W$
'EndOfLine 1
'CharLeft 1, 1
'EditCopy
End Sub
MINAPP.TXT
==========
Sub MAIN
AppMinimize
End Sub
SPELL1.AVE
==========
worddoc = ddeClient.Make("Winword", "c:\temp\spell.doc") 'establish link to Word
if (worddoc.HasError) then
system.execute("c:\msoffice\winword\winword.exe c:\temp\spell.doc /mMinApp")
'MinApp is a Word macro that minimizes the application
worddoc = ddeClient.Make("Winword", "c:\temp\spell.doc") 'establish link to Word
end
done = false
while (not done)
word_to_check = msgbox.input("Enter a word:", "ArcView Spell Checker","")
if (word_to_check <> nil) then
av.run("spell2",{worddoc,word_to_check})
end
if (msgbox.yesno("Check another word?","ArcView Spell Checker", true)) then
done = false
else
worddoc.execute("[FileExit 2]") ' shuts down Word
worddoc.close
done = true
end
end
SPELL2.AVE
==========
'self.get(0) - worddoc DDE Client
'self.get(1) - word to spell
'In line below this note Spelling is the name of the bookmark
'buffer needed for DDE conversation to handle longest string
self.get(0).Poke("Spelling", self.get(1)+string.MakeBuffer(128))
self.get(0).Execute("[GetSpellings]") 'run the Word macro that calls the spell checker
candidates = self.get(0).Request("Spelling") 'get the results of the spell checker
msgbox.ListAsString(candidates.AsTokens("|"),
"Choose an alternative spelling"+NL+"for"++self.get(1)+":", "ArcView Spell Checker")
|
Another Example:
| Code: | /* code begin */
def var wApp as com-handle.
def var ed as char view-as editor inner-lines 10 inner-chars 50.
update ed.
create "Word.Application" wApp.
wApp:Visible = false.
wApp:Documents:Add().
wApp:Documents:Item(1):Range(0,0):InsertAfter(ed).
wApp:Options:CheckGrammarWithSpelling = true.
wApp:Documents:Item(1):CheckGrammar().
ed =
wApp:Documents:Item(1):Range(0,wApp:Documents:Item(1):Characters:Count):Text
.
wApp:Quit(0).
release object wApp.
display ed.
/* code end */
|
Any ideas guys ?
Nathan |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Mon Sep 01, 2003 11:38 am Post subject: |
|
|
Looks like a VBA macro. Where did you get it ? . I will try to get more info if possible but one thing - I can be real slow if you are trying to do in VDS for real time spell check. One reason (other being time) I gave up autocomplete a command/function in my vds tray helper Utility. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Mon Sep 01, 2003 11:53 am Post subject: |
|
|
I have been thinking about plugin, dll, dsu etc for adding Spell check functionatiliy to VDS programs for a long time and I have a solution but it's way, way too slow and to large the Word Library is about 15 Mb Alone never mind the VDS script...
Nathan |
|
| Back to top |
|
 |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Mon Sep 01, 2003 11:58 am Post subject: |
|
|
Ok, even better heres the delphi files needed to create a Spell Check DLL..
I don't know anything about Delphi but after a lot of research on the net, someone pointed me in the direction of this.. If any one can compile this into a VDS spell check DLL, that would be great. They can make it shareware if they wish...
Nathan
heres the link to the fils:
http://www.clarkeware.co.uk/files/wrdspell.zip ( 11kb) |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Mon Sep 01, 2003 12:37 pm Post subject: |
|
|
I am absolutely ignorant about Delphi. If it was C++ then may be I would atleast think of looking into it a little.
Regards _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Mon Sep 01, 2003 2:57 pm Post subject: |
|
|
| Rubes_sw wrote: | | I have been thinking about plugin, dll, dsu etc for adding Spell check functionatiliy to VDS programs for a long time and I have a solution but it's way, way too slow and to large the Word Library is about 15 Mb Alone never mind the VDS script... |
Was that the script I once wrote? It was slow indeed...  _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Mon Sep 01, 2003 3:16 pm Post subject: |
|
|
Ok, I have managed to get the word list down to approx. 1.67 Mb But VDS takes a long time to load it into a list. Making the search procedure very slow...
Nathan
Anyone comments on the source code above? |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Tue Nov 09, 2004 5:54 pm Post subject: |
|
|
Hi Guys,
Did anyone ever come up with a good solution for adding spell checker functionality to VDS apps.? I have read everything related on the forum (including the sample code), but was wondering if anyone ever found a good DLL, or perhaps, wrote some optimized code?
Thanks,
- Boo |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Nov 10, 2004 1:57 am Post subject: |
|
|
You know, I have tons of stuff here for spell checkers, but do not have the
know how to figure out how to get something going. If anyone is interested
in this stuff, I'll dig it up, zip it up and send up!
-Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
|