Pakku Posted June 8, 2007 Share Posted June 8, 2007 Hi all, I wondered if I could use the Microsoft Word API to check if there are spell errors in my string, and if possible in a language of my choice. After a week reseach (nobody ever did it the right way) i came up with the follow Func _SpellCheck($String,$Language) ;For LanguageID use: ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx $WordApp = ObjCreate("Word.Application") $rngRange = ObjCreate("Word.Range") $WordApp.Documents.Add() $rngRange = $WordApp.Activedocument.Range $rngRange.LanguageID = $Language $rngRange.InsertAfter($String) $SpellCollection = $rngRange.SpellingErrors If $SpellCollection.Count > 0 Then Return 0 Else Return 1 EndIf $WordApp.Quit(False) EndFunc oÝ÷ ØZ+¶jx.j붢YhÂ)àÁæì×®®oÝ÷ Ù*"q©º"¶ ©¦z·!yÉ«¢+Ø)Õ¹} ¡ÉµµÈ ÀÌØíMÑÉ¥¹°ÀÌØí1¹Õ¤($($í½È1¹Õ%ÕÍè($í¡ÑÑÀè¼½ÝÝܹµ¥É½Í½Ð¹½´½±½±Ø½Éɹ½±¥µ±°¹µÍÁà($($ÀÌØí]½ÉÁÀô=© ÉÑ ÅÕ½Ðí]½É¹ÁÁ±¥Ñ¥½¸ÅÕ½Ðì¤($ÀÌØíɹI¹ô=© ÉÑ ÅÕ½Ðí]½É¹I¹ÅÕ½Ðì¤($ÀÌØí]½ÉÁÀ¹½Õµ¹Ñ̹ ¤($ÀÌØíɹI¹ôÀÌØí]½ÉÁÀ¹Ñ¥Ù½Õµ¹Ð¹I¹($ÀÌØíɹI¹¹1¹Õ%ôÀÌØí1¹Õ($ÀÌØíɹI¹¹%¹ÍÉÑÑÈ ÀÌØíMÑÉ¥¹¤($ÀÌØíɵµÉ ½±±Ñ¥½¸ôÀÌØíɹI¹¹ÉµµÑ¥±ÉɽÉÌ(%ÀÌØíɵµÉ ½±±Ñ¥½¸¹ ½Õ¹ÐÐìÀQ¡¸(IÑÕɸÀ(±Í(IÑÕɸÄ(¹%($ÀÌØí]½ÉÁÀ¹EեС±Í¤)¹Õ¹oÝ÷ Ù'iº/yú+¶¥jx.j¬zÛbéZ²Ú'xZ¾}ý¶×¬µçrzÖî¶+l¥w +b²,²&åzÚ%zÚh¦êZv&¥¢"µÈç$²Ø^¶¦ªè®Ø^²¥)ànëm«b²}ý·Z´×ÊjwhÖòi×bh® Úf«jëh×6 $GrammarCollection.CheckGrammar Have a nice day and feedback is more than welcome! How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me Link to comment Share on other sites More sharing options...
jvanegmond Posted June 8, 2007 Share Posted June 8, 2007 You are definitely on to something. This returns whether it is right or wrong, but what would be great if you could get it to return possible corrections! github.com/jvanegmond Link to comment Share on other sites More sharing options...
Developers Jos Posted June 8, 2007 Developers Share Posted June 8, 2007 Looks familiar from way back when before any com was available http://www.autoitscript.com/forum/index.ph...ost&p=10067 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
GEOSoft Posted June 9, 2007 Share Posted June 9, 2007 Looks familiar from way back when before any com was available http://www.autoitscript.com/forum/index.ph...ost&p=10067I still have one that I think you wrote and it comes in handy every now and then. It (IIRC) checks the selected text and then either puts it on the clipboard or shoots it into the doc. I might have added the shoot feature myself. I don't remember now. I started writing one that would check an entire document and check against a Scrabble word list but it was horrendously slow so I mothballed it. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
MrCreatoR Posted June 9, 2007 Share Posted June 9, 2007 (edited) Hi all,I have tried to make this function work without create temp vbs file (like here), but i have one problem:_SpellCheckProc("1033") Func _SpellCheckProc($Language) $Word = ObjCreate("word.Application") $Word.WindowState = 2 $Word.Visible = True $Doc = $Word.Documents.Add("", "", 1, True) $Word.Selection.Paste If Not @error Then $Word.Selection.LanguageID = $Language $Doc.CheckGrammar $Word.Selection.WholeStory $Word.Selection.Copy EndIf $Doc.Close = False $Word.Application.Quit True EndFuncoÝ÷ ضØb±ê뢺®¢×êު笵çZrبØb²ãyËajÇÚWÓ~¡But the problem the same...This work fine if i use the same code in vbs file (or create it from my script), but it wont work from the script, why? hot to make this work?EDIT:This work now (the second example), i forgot about the cariage returns and line feads (@CRLF) Thanks to all. Edited June 9, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MHz Posted June 9, 2007 Share Posted June 9, 2007 I get this error:Skipped parameters in VBS are replaced with the Default keyword in AutoIt.And also i tried like this (call vbs code):I see no CRLFs used so it is one big line. Link to comment Share on other sites More sharing options...
MrCreatoR Posted June 9, 2007 Share Posted June 9, 2007 MHzSkipped parameters in VBS are replaced with the Default keyword in AutoIt.But how to use this method in autoIt? maby i need to set those parameters as something else?I see no CRLFs used so it is one big line.Yes, thanks, i realized this before i see your post, realy :"> - and edit it just 7 minutes after you posted , the page probably was not updated (i am using Opera browser). Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 9, 2007 Moderators Share Posted June 9, 2007 I made a spell check GUI that uses Word's COM functionality.Custom Spell Checker Link to comment Share on other sites More sharing options...
Pakku Posted June 10, 2007 Author Share Posted June 10, 2007 I made a spell check GUI that uses Word's COM functionality.Custom Spell CheckerNice one! How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me Link to comment Share on other sites More sharing options...
MHz Posted June 10, 2007 Share Posted June 10, 2007 But how to use this method in autoIt? maby i need to set those parameters as something else?VBS skips parameters like below Set Doc = Word.Documents.Add( , , 1, True) AutoIt does not allow skipped/empty parameters as such so you use the Default keyword $Doc = $Word.Documents.Add(Default, Default, 1, True) You were using "" instead which is different to using Default. Link to comment Share on other sites More sharing options...
MrCreatoR Posted June 12, 2007 Share Posted June 12, 2007 AutoIt does not allow skipped/empty parameters as such so you use the Default keywordThanks a lot... But now i get the error when it's trying (not) to close the window: $Doc.Close = False The requested action with this object has failed.: $Doc.Close = False $Doc.Close = False ^ ERROR When i write this line like this: $Doc.Close (False) It's ok, there is no error, but the window of word is not closing untill i finish the spelling corrections - how am i do that the window will not been shown at all? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 12, 2007 Moderators Share Posted June 12, 2007 @MsCreatoR - Did you ever think to use the built-in MS Word Functions? Link to comment Share on other sites More sharing options...
MrCreatoR Posted June 16, 2007 Share Posted June 16, 2007 big_daddyDid you ever think to use the built-in MS Word Functions?Hmm... I don't sure if i understand what you mean? where i find those functions? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
i542 Posted June 16, 2007 Share Posted June 16, 2007 Hi all,I wondered if I could use the Microsoft Word API to check if there are spell errors in my string, and if possible in a language of my choice.(...)It is nice. As far as I can see because I don't have Word. I use OpenOffice.org instead.Looks familiar from way back when before any com was available http://www.autoitscript.com/forum/index.ph...ost&p=10067ouch, JdeB gived you a fire punch, arjan! I can do signature me. Link to comment Share on other sites More sharing options...
Pakku Posted June 16, 2007 Author Share Posted June 16, 2007 (edited) It is nice. As far as I can see because I don't have Word. I use OpenOffice.org instead.ouch, JdeB gived you a fire punch, arjan!hahaha, i know he means well (well i hope ) Edited November 16, 2010 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me Link to comment Share on other sites More sharing options...
Developers Jos Posted June 16, 2007 Developers Share Posted June 16, 2007 hahaha, i know he means well (well i hope )ArjanDon't understand where I987 is coming from but just get used to him not making any sense what so ever ..... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 18, 2007 Moderators Share Posted June 18, 2007 big_daddyHmm... I don't sure if i understand what you mean? where i find those functions? The help file..._WordCreate()_WordDocGetCollection()etc... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now